@shell-shock/core 0.10.0 → 0.11.0
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.
- package/dist/components/docs.cjs +4 -4
- package/dist/components/docs.cjs.map +1 -1
- package/dist/components/docs.d.cts +5 -5
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +5 -5
- package/dist/components/helpers.d.cts +6 -6
- package/dist/components/helpers.d.mts +6 -6
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/options-parser-logic.cjs +31 -31
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +9 -9
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +9 -9
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +26 -26
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/usage.cjs +5 -5
- package/dist/components/usage.cjs.map +1 -1
- package/dist/components/usage.d.cts +2 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts +2 -2
- package/dist/components/usage.mjs +4 -4
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +2 -2
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.mjs +5 -5
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/contexts/options.cjs +2 -2
- package/dist/contexts/options.cjs.map +1 -1
- package/dist/contexts/options.d.cts +1 -1
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts +1 -1
- package/dist/contexts/options.d.mts.map +1 -1
- package/dist/contexts/options.mjs +4 -4
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/helpers/automd.cjs +2 -2
- package/dist/helpers/automd.cjs.map +1 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/helpers/paths.cjs +125 -0
- package/dist/helpers/paths.cjs.map +1 -0
- package/dist/helpers/paths.mjs +121 -0
- package/dist/helpers/paths.mjs.map +1 -0
- package/dist/helpers/persistence.cjs +68 -116
- package/dist/helpers/persistence.cjs.map +1 -1
- package/dist/helpers/persistence.mjs +68 -116
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +4 -4
- package/dist/helpers/update-package-json.cjs.map +1 -1
- package/dist/helpers/utilities.cjs +1 -1
- package/dist/helpers/utilities.mjs +1 -1
- package/dist/helpers/validations.cjs +2 -3
- package/dist/helpers/validations.cjs.map +1 -1
- package/dist/helpers/validations.mjs +2 -2
- package/dist/helpers/validations.mjs.map +1 -1
- package/dist/index.cjs +14 -11
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/plugin-utils/deepkit.cjs +72 -0
- package/dist/plugin-utils/deepkit.cjs.map +1 -0
- package/dist/plugin-utils/deepkit.d.cts +24 -0
- package/dist/plugin-utils/deepkit.d.cts.map +1 -0
- package/dist/plugin-utils/deepkit.d.mts +24 -0
- package/dist/plugin-utils/deepkit.d.mts.map +1 -0
- package/dist/plugin-utils/deepkit.mjs +70 -0
- package/dist/plugin-utils/deepkit.mjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.cjs +2 -2
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/index.cjs +27 -18
- package/dist/plugin-utils/index.d.cts +3 -1
- package/dist/plugin-utils/index.d.mts +3 -1
- package/dist/plugin-utils/index.mjs +3 -1
- package/dist/plugin-utils/reflect.cjs +4 -5
- package/dist/plugin-utils/reflect.cjs.map +1 -1
- package/dist/plugin-utils/reflect.mjs +4 -4
- package/dist/plugin-utils/reflect.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +89 -0
- package/dist/plugin-utils/type-checks.cjs.map +1 -0
- package/dist/plugin-utils/type-checks.d.cts +42 -0
- package/dist/plugin-utils/type-checks.d.cts.map +1 -0
- package/dist/plugin-utils/type-checks.d.mts +42 -0
- package/dist/plugin-utils/type-checks.d.mts.map +1 -0
- package/dist/plugin-utils/type-checks.mjs +84 -0
- package/dist/plugin-utils/type-checks.mjs.map +1 -0
- package/dist/plugin.cjs +28 -24
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +12 -8
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +129 -0
- package/dist/resolver/deepkit.cjs.map +1 -0
- package/dist/resolver/deepkit.mjs +128 -0
- package/dist/resolver/deepkit.mjs.map +1 -0
- package/dist/resolver/helpers.cjs +173 -0
- package/dist/resolver/helpers.cjs.map +1 -0
- package/dist/resolver/helpers.mjs +168 -0
- package/dist/resolver/helpers.mjs.map +1 -0
- package/dist/resolver/module.cjs +144 -0
- package/dist/resolver/module.cjs.map +1 -0
- package/dist/resolver/module.mjs +143 -0
- package/dist/resolver/module.mjs.map +1 -0
- package/dist/resolver/resolve.cjs +209 -0
- package/dist/resolver/resolve.cjs.map +1 -0
- package/dist/resolver/resolve.mjs +208 -0
- package/dist/resolver/resolve.mjs.map +1 -0
- package/dist/types/command.cjs +127 -104
- package/dist/types/command.cjs.map +1 -1
- package/dist/types/command.d.cts +39 -78
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +39 -78
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +115 -95
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/context.cjs +1 -1
- package/dist/types/context.cjs.map +1 -1
- package/dist/types/context.d.cts +2 -2
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +2 -2
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/context.mjs +1 -1
- package/dist/types/context.mjs.map +1 -1
- package/dist/types/index.cjs +13 -10
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/package.json +24 -75
- package/dist/helpers/resolve-command.cjs +0 -430
- package/dist/helpers/resolve-command.cjs.map +0 -1
- package/dist/helpers/resolve-command.mjs +0 -425
- package/dist/helpers/resolve-command.mjs.map +0 -1
|
@@ -1,430 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_plugin_utils_context_helpers = require('../plugin-utils/context-helpers.cjs');
|
|
3
|
-
const require_utilities = require('./utilities.cjs');
|
|
4
|
-
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
5
|
-
let __stryke_path_append = require("@stryke/path/append");
|
|
6
|
-
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
7
|
-
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
8
|
-
let __stryke_path_replace = require("@stryke/path/replace");
|
|
9
|
-
let __stryke_path_resolve_parent_path = require("@stryke/path/resolve-parent-path");
|
|
10
|
-
let __stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
11
|
-
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
12
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
13
|
-
let powerlines_utils = require("powerlines/utils");
|
|
14
|
-
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
15
|
-
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
16
|
-
let __powerlines_deepkit_esbuild_plugin = require("@powerlines/deepkit/esbuild-plugin");
|
|
17
|
-
let __powerlines_plugin_esbuild_helpers_resolve = require("@powerlines/plugin-esbuild/helpers/resolve");
|
|
18
|
-
let __stryke_path_common = require("@stryke/path/common");
|
|
19
|
-
let __stryke_path_normalize = require("@stryke/path/normalize");
|
|
20
|
-
let node_fs = require("node:fs");
|
|
21
|
-
|
|
22
|
-
//#region src/helpers/resolve-command.ts
|
|
23
|
-
function __assignType(fn, args) {
|
|
24
|
-
fn.__type = args;
|
|
25
|
-
return fn;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Resolves the description for a command option based on its reflection.
|
|
29
|
-
*
|
|
30
|
-
* @param name - The name of the command option.
|
|
31
|
-
* @param kind - The reflection kind of the command option.
|
|
32
|
-
* @param optional - Whether the command option is optional.
|
|
33
|
-
* @param variadic - Whether the command option is variadic (i.e., an array).
|
|
34
|
-
* @param title - The title of the command option, if any.
|
|
35
|
-
* @param defaultValue - The default value of the command option, if any.
|
|
36
|
-
* @returns The resolved description for the command option.
|
|
37
|
-
*/
|
|
38
|
-
function resolveCommandOptionDescription(name, kind, optional = false, variadic = false, title, defaultValue) {
|
|
39
|
-
return `A${optional && !defaultValue ? "n optional" : ""} command-line ${kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean ? "flag" : "option"} that allows the user to ${kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean ? "set the" : variadic ? "specify custom" : "specify a custom"} ${title?.trim() || (0, __stryke_string_format_title_case.titleCase)(name)} ${kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean ? "indicator" : `${kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? "numeric" : "string"} value${variadic ? "s" : ""}`}.`;
|
|
40
|
-
}
|
|
41
|
-
resolveCommandOptionDescription.__type = [
|
|
42
|
-
"name",
|
|
43
|
-
() => __powerlines_deepkit_vendor_type.__ΩReflectionKind,
|
|
44
|
-
"kind",
|
|
45
|
-
"optional",
|
|
46
|
-
"variadic",
|
|
47
|
-
"title",
|
|
48
|
-
"defaultValue",
|
|
49
|
-
"resolveCommandOptionDescription",
|
|
50
|
-
"P&2!n\"2#\"2$\"2%&2&8\"2'8&/("
|
|
51
|
-
];
|
|
52
|
-
/**
|
|
53
|
-
* Resolves the description for a command argument based on its reflection.
|
|
54
|
-
*
|
|
55
|
-
* @param name - The name of the command argument.
|
|
56
|
-
* @param kind - The reflection kind of the command argument.
|
|
57
|
-
* @param optional - Whether the command argument is optional.
|
|
58
|
-
* @param variadic - Whether the command argument is variadic (i.e., an array).
|
|
59
|
-
* @param title - The title of the command argument, if any.
|
|
60
|
-
* @param defaultValue - The default value of the command argument, if any.
|
|
61
|
-
* @returns The resolved description for the command argument.
|
|
62
|
-
*/
|
|
63
|
-
function resolveCommandArgumentDescription(name, kind, optional = false, variadic = false, title, defaultValue) {
|
|
64
|
-
return `An${optional && !defaultValue ? " optional" : ""} argument that allows the user to ${kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean ? "set the" : variadic ? "specify custom" : "specify a custom"} ${title?.trim() || (0, __stryke_string_format_title_case.titleCase)(name)} ${kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean ? "indicator" : `${kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? "numeric" : "string"} value${variadic ? "s" : ""}`}.`;
|
|
65
|
-
}
|
|
66
|
-
resolveCommandArgumentDescription.__type = [
|
|
67
|
-
"name",
|
|
68
|
-
() => __powerlines_deepkit_vendor_type.__ΩReflectionKind,
|
|
69
|
-
"kind",
|
|
70
|
-
"optional",
|
|
71
|
-
"variadic",
|
|
72
|
-
"title",
|
|
73
|
-
"defaultValue",
|
|
74
|
-
"resolveCommandArgumentDescription",
|
|
75
|
-
"P&2!n\"2#\"2$\"2%&2&8\"2'8&/("
|
|
76
|
-
];
|
|
77
|
-
function resolveCommandId(context, file) {
|
|
78
|
-
return (0, __stryke_path_replace.replacePath)((0, __stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).split("/").filter(__assignType((p) => Boolean(p) && !require_plugin_utils_context_helpers.isDynamicPathSegment(p), [
|
|
79
|
-
"p",
|
|
80
|
-
"",
|
|
81
|
-
"P\"2!\"/\""
|
|
82
|
-
])).join("/").replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").replaceAll("/", "-");
|
|
83
|
-
}
|
|
84
|
-
resolveCommandId.__type = [
|
|
85
|
-
"Context",
|
|
86
|
-
"context",
|
|
87
|
-
"file",
|
|
88
|
-
"resolveCommandId",
|
|
89
|
-
"P\"w!2\"&2#&/$"
|
|
90
|
-
];
|
|
91
|
-
/**
|
|
92
|
-
* Finds the command name from the given file path.
|
|
93
|
-
*
|
|
94
|
-
* @param file - The file path to extract the command name from.
|
|
95
|
-
* @returns The command name.
|
|
96
|
-
*/
|
|
97
|
-
function resolveCommandName(file) {
|
|
98
|
-
let path = (0, __stryke_path_file_path_fns.findFilePath)(file);
|
|
99
|
-
let name = (0, __stryke_path_file_path_fns.findFolderName)(file, { requireExtension: true });
|
|
100
|
-
while (require_plugin_utils_context_helpers.isDynamicPathSegment(name)) {
|
|
101
|
-
path = (0, __stryke_path_resolve_parent_path.resolveParentPath)(path);
|
|
102
|
-
name = (0, __stryke_path_file_path_fns.findFolderName)(path, { requireExtension: true });
|
|
103
|
-
}
|
|
104
|
-
return name;
|
|
105
|
-
}
|
|
106
|
-
resolveCommandName.__type = [
|
|
107
|
-
"file",
|
|
108
|
-
"resolveCommandName",
|
|
109
|
-
"P&2!\"/\""
|
|
110
|
-
];
|
|
111
|
-
function resolveCommandPath(context, file) {
|
|
112
|
-
return (0, __stryke_path_replace.replacePath)((0, __stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").split("/").filter(__assignType((path) => path && !require_plugin_utils_context_helpers.isPathSegmentGroup(path), [
|
|
113
|
-
"path",
|
|
114
|
-
"",
|
|
115
|
-
"P\"2!\"/\""
|
|
116
|
-
])).join("/");
|
|
117
|
-
}
|
|
118
|
-
resolveCommandPath.__type = [
|
|
119
|
-
"Context",
|
|
120
|
-
"context",
|
|
121
|
-
"file",
|
|
122
|
-
"resolveCommandPath",
|
|
123
|
-
"P\"w!2\"&2#&/$"
|
|
124
|
-
];
|
|
125
|
-
function resolveCommandDynamicPathSegments(context, file) {
|
|
126
|
-
return (0, __stryke_path_replace.replacePath)((0, __stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).split("/").filter(__assignType((path) => Boolean(path) && require_plugin_utils_context_helpers.isDynamicPathSegment(path), [
|
|
127
|
-
"path",
|
|
128
|
-
"",
|
|
129
|
-
"P\"2!\"/\""
|
|
130
|
-
])).map(__assignType((path) => require_plugin_utils_context_helpers.getDynamicPathSegmentName(path), [
|
|
131
|
-
"path",
|
|
132
|
-
"",
|
|
133
|
-
"P\"2!\"/\""
|
|
134
|
-
]));
|
|
135
|
-
}
|
|
136
|
-
resolveCommandDynamicPathSegments.__type = [
|
|
137
|
-
"Context",
|
|
138
|
-
"context",
|
|
139
|
-
"file",
|
|
140
|
-
"resolveCommandDynamicPathSegments",
|
|
141
|
-
"P\"w!2\"&2#&F/$"
|
|
142
|
-
];
|
|
143
|
-
function findCommandsRoot(context) {
|
|
144
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(context.config.input)) return (0, __stryke_path_append.appendPath)((0, __stryke_path_append.appendPath)((0, __stryke_path_normalize.stripStars)(context.config.input), context.config.root), context.workspaceConfig.workspaceRoot);
|
|
145
|
-
else if ((0, powerlines_utils.isTypeDefinition)(context.config.input)) return (0, __stryke_path_append.appendPath)((0, __stryke_path_append.appendPath)((0, __stryke_path_normalize.stripStars)(context.config.input.file), context.config.root), context.workspaceConfig.workspaceRoot);
|
|
146
|
-
else if (Array.isArray(context.config.input) && context.config.input.length > 0) return (0, __stryke_path_common.commonPath)(context.config.input.map(__assignType((input) => (0, __stryke_path_append.appendPath)((0, __stryke_path_append.appendPath)((0, __stryke_path_normalize.stripStars)((0, __stryke_type_checks_is_set_string.isSetString)(input) ? input : input.file), context.config.root), context.workspaceConfig.workspaceRoot), [
|
|
147
|
-
"input",
|
|
148
|
-
"",
|
|
149
|
-
"P\"2!\"/\""
|
|
150
|
-
])));
|
|
151
|
-
else if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.config.input)) return (0, __stryke_path_common.commonPath)(Object.values(context.config.input).map(__assignType((input) => Array.isArray(input) ? (0, __stryke_path_common.commonPath)(input.map(__assignType((i) => (0, __stryke_path_append.appendPath)((0, __stryke_path_append.appendPath)((0, __stryke_path_normalize.stripStars)((0, __stryke_type_checks_is_set_string.isSetString)(i) ? i : i.file), context.config.root), context.workspaceConfig.workspaceRoot), [
|
|
152
|
-
"i",
|
|
153
|
-
"",
|
|
154
|
-
"P\"2!\"/\""
|
|
155
|
-
]))) : (0, __stryke_path_append.appendPath)((0, __stryke_path_append.appendPath)((0, __stryke_path_normalize.stripStars)((0, __stryke_type_checks_is_set_string.isSetString)(input) ? input : input.file), context.config.root), context.workspaceConfig.workspaceRoot), [
|
|
156
|
-
"input",
|
|
157
|
-
"",
|
|
158
|
-
"P\"2!\"/\""
|
|
159
|
-
])));
|
|
160
|
-
let commandsPath = (0, __stryke_path_join_paths.joinPaths)(context.config.root, "src/commands");
|
|
161
|
-
if (!(0, node_fs.existsSync)(commandsPath)) {
|
|
162
|
-
commandsPath = (0, __stryke_path_join_paths.joinPaths)(context.config.root, "commands");
|
|
163
|
-
if (!(0, node_fs.existsSync)(commandsPath)) {
|
|
164
|
-
commandsPath = (0, __stryke_path_join_paths.joinPaths)(context.config.root, "src");
|
|
165
|
-
if (!(0, node_fs.existsSync)(commandsPath)) commandsPath = context.config.root;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return (0, __stryke_path_append.appendPath)(commandsPath, context.workspaceConfig.workspaceRoot);
|
|
169
|
-
}
|
|
170
|
-
findCommandsRoot.__type = [
|
|
171
|
-
"Context",
|
|
172
|
-
"context",
|
|
173
|
-
"findCommandsRoot",
|
|
174
|
-
"P\"w!2\"&/#"
|
|
175
|
-
];
|
|
176
|
-
/**
|
|
177
|
-
* Extracts command parameter information from a type parameter reflection.
|
|
178
|
-
*
|
|
179
|
-
* @param command - The command tree to which the parameter belongs.
|
|
180
|
-
* @param reflection - The type parameter reflection to extract information from.
|
|
181
|
-
* @returns The extracted command option information.
|
|
182
|
-
*/
|
|
183
|
-
function extractCommandOption(command, reflection) {
|
|
184
|
-
const type = reflection.getType();
|
|
185
|
-
const option = {
|
|
186
|
-
name: reflection.getNameAsString(),
|
|
187
|
-
alias: reflection.getTags().alias ?? [],
|
|
188
|
-
title: reflection.getTags().title?.trim() || (0, __stryke_string_format_title_case.titleCase)(reflection.getNameAsString()),
|
|
189
|
-
description: reflection.getDescription() || resolveCommandOptionDescription(reflection.getNameAsString(), reflection.getKind(), reflection.isOptional(), reflection.isArray(), reflection.getTags().title, reflection.getDefaultValue()),
|
|
190
|
-
env: (0, __stryke_string_format_constant_case.constantCase)(reflection.getNameAsString()),
|
|
191
|
-
kind: type.kind,
|
|
192
|
-
optional: reflection.isOptional(),
|
|
193
|
-
default: reflection.getDefaultValue(),
|
|
194
|
-
variadic: reflection.isArray(),
|
|
195
|
-
reflection
|
|
196
|
-
};
|
|
197
|
-
if (reflection.isArray()) if (type.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || type.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) {
|
|
198
|
-
option.variadic = true;
|
|
199
|
-
option.kind = type.type.kind;
|
|
200
|
-
} else throw new Error(`Unsupported array type for option "${reflection.getNameAsString()}" in command "${command.name}". Only string[] and number[] are supported, received ${(0, __powerlines_deepkit_vendor_type.stringifyType)(type).trim().replaceAll(" | ", ", or ")}.`);
|
|
201
|
-
else if (type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.boolean && type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.string && type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.number) throw new Error(`Unsupported type for option "${reflection.getNameAsString()}" in command "${command.name}". Only string, number, boolean, string[] and number[] are supported, received ${(0, __powerlines_deepkit_vendor_type.stringifyType)(type).trim().replaceAll(" | ", ", or ")}.`);
|
|
202
|
-
return option;
|
|
203
|
-
}
|
|
204
|
-
extractCommandOption.__type = [
|
|
205
|
-
"CommandInput",
|
|
206
|
-
"command",
|
|
207
|
-
"ReflectionProperty",
|
|
208
|
-
"reflection",
|
|
209
|
-
"CommandOption",
|
|
210
|
-
"extractCommandOption",
|
|
211
|
-
"P\"w!2\"\"w#2$\"w%/&"
|
|
212
|
-
];
|
|
213
|
-
/**
|
|
214
|
-
* Extracts command positional argument information from a type parameter reflection.
|
|
215
|
-
*
|
|
216
|
-
* @param command - The command tree to which the parameter belongs.
|
|
217
|
-
* @param reflection - The type parameter reflection to extract information from.
|
|
218
|
-
* @returns The extracted command positional argument information.
|
|
219
|
-
*/
|
|
220
|
-
function extractCommandArgument(command, reflection) {
|
|
221
|
-
const type = reflection.getType();
|
|
222
|
-
if (type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.string && type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.number && type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.boolean && !(type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.array && (type.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || type.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number))) throw new Error(`Unsupported type for argument "${reflection.getName()}" in command "${command.name}". Only string types (or an array of strings) are supported, received ${(0, __powerlines_deepkit_vendor_type.stringifyType)(type).trim().replaceAll(" | ", ", or ")}.`);
|
|
223
|
-
const argument = {
|
|
224
|
-
name: reflection.getName(),
|
|
225
|
-
alias: reflection.getAlias(),
|
|
226
|
-
kind: type.kind,
|
|
227
|
-
title: (0, __stryke_string_format_title_case.titleCase)(reflection.getName()),
|
|
228
|
-
description: reflection.parameter.description || resolveCommandArgumentDescription(reflection.getName(), type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.array ? type.type.kind : type.kind, reflection.isOptional(), type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.array, (0, __stryke_string_format_title_case.titleCase)(reflection.getName()), reflection.getDefaultValue()),
|
|
229
|
-
env: (0, __stryke_string_format_constant_case.constantCase)(reflection.getName()),
|
|
230
|
-
optional: reflection.isOptional(),
|
|
231
|
-
default: reflection.getDefaultValue(),
|
|
232
|
-
reflection
|
|
233
|
-
};
|
|
234
|
-
if (type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.array) if (type.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || type.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) {
|
|
235
|
-
argument.variadic = true;
|
|
236
|
-
argument.kind = type.type.kind;
|
|
237
|
-
} else throw new Error(`Unsupported array type for argument "${reflection.getName()}" in command "${command.name}". Only string[] and number[] are supported, received ${(0, __powerlines_deepkit_vendor_type.stringifyType)(type).trim().replaceAll(" | ", ", or ")}.`);
|
|
238
|
-
else if (type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.boolean && type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.string && type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.number) throw new Error(`Unsupported type for argument "${reflection.getName()}" in command "${command.name}". Only string, number, boolean, string[] and number[] are supported, received ${(0, __powerlines_deepkit_vendor_type.stringifyType)(type).trim().replaceAll(" | ", ", or ")}.`);
|
|
239
|
-
return argument;
|
|
240
|
-
}
|
|
241
|
-
extractCommandArgument.__type = [
|
|
242
|
-
"CommandInput",
|
|
243
|
-
"command",
|
|
244
|
-
"ReflectionParameter",
|
|
245
|
-
"reflection",
|
|
246
|
-
"CommandArgument",
|
|
247
|
-
"extractCommandArgument",
|
|
248
|
-
"P\"w!2\"\"w#2$\"w%/&"
|
|
249
|
-
];
|
|
250
|
-
/**
|
|
251
|
-
* Reflects the command tree for a given command input.
|
|
252
|
-
*
|
|
253
|
-
* @param context - The context in which the command is being reflected.
|
|
254
|
-
* @param command - The command input to reflect.
|
|
255
|
-
* @param parent - The parent command tree, if any.
|
|
256
|
-
* @returns The reflected command tree.
|
|
257
|
-
*/
|
|
258
|
-
async function reflectCommandTree(context, command, parent) {
|
|
259
|
-
const title = command.title || `${parent?.title ? `${parent.isVirtual ? parent.title.replace(/(?:c|C)ommands?$/, "").trim() : parent.title} - ` : ""}${(0, __stryke_string_format_title_case.titleCase)(command.name)}${command.isVirtual ? " Commands" : ""}`;
|
|
260
|
-
const tree = {
|
|
261
|
-
alias: [],
|
|
262
|
-
icon: parent?.icon,
|
|
263
|
-
...command,
|
|
264
|
-
title,
|
|
265
|
-
options: require_utilities.getDefaultOptions(context, command),
|
|
266
|
-
arguments: [],
|
|
267
|
-
parent: parent ?? null,
|
|
268
|
-
children: {},
|
|
269
|
-
reflection: null
|
|
270
|
-
};
|
|
271
|
-
if (!command.isVirtual) {
|
|
272
|
-
if (!command.entry.input?.file || !context.fs.existsSync(command.entry.input.file)) throw new Error(`${!command.entry.input?.file ? "Missing" : "Non-existent"} command entry file for "${command.name}"`);
|
|
273
|
-
context.debug(`Adding reflection for user-defined command: ${command.id} (file: ${command.entry.input.file})`);
|
|
274
|
-
const resolved = await (__powerlines_plugin_esbuild_helpers_resolve.resolveModule.Ω = [["CommandModule", "\"w!"]], (0, __powerlines_plugin_esbuild_helpers_resolve.resolveModule)(context, command.entry.input, { plugins: [(0, __powerlines_deepkit_esbuild_plugin.esbuildPlugin)(context, {
|
|
275
|
-
reflection: "default",
|
|
276
|
-
reflectionLevel: "verbose"
|
|
277
|
-
})] }));
|
|
278
|
-
const metadata = resolved.metadata ?? {};
|
|
279
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(metadata.title)) tree.title = metadata.title;
|
|
280
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(metadata.description)) tree.description = metadata.description;
|
|
281
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(metadata.alias) || Array.isArray(metadata.alias) && metadata.alias.length > 0) tree.alias = (0, __stryke_convert_to_array.toArray)(metadata.alias);
|
|
282
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(metadata.icon)) tree.icon = metadata.icon;
|
|
283
|
-
const type = (0, __powerlines_deepkit_vendor_type.reflect)(resolved);
|
|
284
|
-
if (type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.function) throw new Error(`The command entry file "${command.entry.input.file}" does not export a valid function.`);
|
|
285
|
-
tree.reflection = new __powerlines_deepkit_vendor_type.ReflectionFunction(type);
|
|
286
|
-
tree.description ??= command.description || type.description || `The ${tree.title.replace(/(?:c|C)ommands?$/, "").trim()} executable command-line interface.`;
|
|
287
|
-
const parameters = tree.reflection.getParameters();
|
|
288
|
-
if (parameters.length > 0 && parameters[0]) {
|
|
289
|
-
if (parameters[0].type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral || parameters[0].type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.class) {
|
|
290
|
-
const optionsReflection = __powerlines_deepkit_vendor_type.ReflectionClass.from(parameters[0].type);
|
|
291
|
-
for (const propertyReflection of optionsReflection.getProperties()) tree.options[propertyReflection.getNameAsString()] = extractCommandOption(command, propertyReflection);
|
|
292
|
-
} else throw new Error(`The first parameter of the command handler function in "${command.entry.input.file}" must be an object literal or class type representing the command options.`);
|
|
293
|
-
tree.arguments = parameters.slice(1).map(__assignType((arg) => extractCommandArgument(command, arg), [
|
|
294
|
-
"arg",
|
|
295
|
-
"",
|
|
296
|
-
"P\"2!\"/\""
|
|
297
|
-
]));
|
|
298
|
-
tree.arguments.forEach(__assignType((argument, index) => {
|
|
299
|
-
const found = tree.arguments.findIndex(__assignType((arg) => arg.name === argument.name, [
|
|
300
|
-
"arg",
|
|
301
|
-
"",
|
|
302
|
-
"P\"2!\"/\""
|
|
303
|
-
]));
|
|
304
|
-
if (found !== -1 && found !== index || tree.segments.some(__assignType((segment) => require_plugin_utils_context_helpers.isDynamicPathSegment(segment) && require_plugin_utils_context_helpers.getDynamicPathSegmentName(segment) === argument.name, [
|
|
305
|
-
"segment",
|
|
306
|
-
"",
|
|
307
|
-
"P\"2!\"/\""
|
|
308
|
-
]))) {
|
|
309
|
-
argument.name += `_${tree.segments.filter(__assignType((segment) => require_plugin_utils_context_helpers.isDynamicPathSegment(segment) && require_plugin_utils_context_helpers.getDynamicPathSegmentName(segment).replace(/_\d+$/, "") === argument.name, [
|
|
310
|
-
"segment",
|
|
311
|
-
"",
|
|
312
|
-
"P\"2!\"/\""
|
|
313
|
-
])).length + tree.arguments.filter(__assignType((arg) => arg.name.replace(/_\d+$/, "") === argument.name, [
|
|
314
|
-
"arg",
|
|
315
|
-
"",
|
|
316
|
-
"P\"2!\"/\""
|
|
317
|
-
])).length}`;
|
|
318
|
-
argument.env = (0, __stryke_string_format_constant_case.constantCase)(argument.name);
|
|
319
|
-
}
|
|
320
|
-
}, [
|
|
321
|
-
"argument",
|
|
322
|
-
"index",
|
|
323
|
-
"",
|
|
324
|
-
"P\"2!\"2\"\"/#"
|
|
325
|
-
]));
|
|
326
|
-
}
|
|
327
|
-
} else tree.description ??= `A collection of available ${tree.title.replace(/(?:c|C)ommands?$/, "").trim() || (0, __stryke_string_format_title_case.titleCase)(tree.name)} commands that are included in the ${require_plugin_utils_context_helpers.getAppTitle(context)} command-line application.`;
|
|
328
|
-
if (context.env) {
|
|
329
|
-
if ((0, __stryke_type_checks_is_set_object.isSetObject)(tree.options)) Object.values(tree.options).filter(__assignType((option) => option.env !== false, [
|
|
330
|
-
"option",
|
|
331
|
-
"",
|
|
332
|
-
"P\"2!\"/\""
|
|
333
|
-
])).forEach(__assignType((option) => {
|
|
334
|
-
context.env.types.env.addProperty({
|
|
335
|
-
name: option.env,
|
|
336
|
-
optional: option.optional ? true : void 0,
|
|
337
|
-
description: option.description,
|
|
338
|
-
visibility: __powerlines_deepkit_vendor_type.ReflectionVisibility.public,
|
|
339
|
-
type: option.reflection?.getType() ?? (option.variadic ? {
|
|
340
|
-
kind: __powerlines_deepkit_vendor_type.ReflectionKind.array,
|
|
341
|
-
type: { kind: option.kind }
|
|
342
|
-
} : { kind: option.kind }),
|
|
343
|
-
default: option.default,
|
|
344
|
-
tags: {
|
|
345
|
-
...option.reflection?.getTags(),
|
|
346
|
-
title: option.title,
|
|
347
|
-
alias: option.alias.filter(__assignType((alias) => alias.length > 1, [
|
|
348
|
-
"alias",
|
|
349
|
-
"",
|
|
350
|
-
"P\"2!\"/\""
|
|
351
|
-
])).map(__assignType((alias) => (0, __stryke_string_format_constant_case.constantCase)(alias), [
|
|
352
|
-
"alias",
|
|
353
|
-
"",
|
|
354
|
-
"P\"2!\"/\""
|
|
355
|
-
])),
|
|
356
|
-
domain: "cli"
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
}, [
|
|
360
|
-
"option",
|
|
361
|
-
"",
|
|
362
|
-
"P\"2!\"/\""
|
|
363
|
-
]));
|
|
364
|
-
tree.arguments.filter(__assignType((arg) => arg.env !== false, [
|
|
365
|
-
"arg",
|
|
366
|
-
"",
|
|
367
|
-
"P\"2!\"/\""
|
|
368
|
-
])).forEach(__assignType((arg) => context.env.types.env.addProperty({
|
|
369
|
-
name: arg.env,
|
|
370
|
-
optional: arg.optional ? true : void 0,
|
|
371
|
-
description: arg.description,
|
|
372
|
-
visibility: __powerlines_deepkit_vendor_type.ReflectionVisibility.public,
|
|
373
|
-
type: arg.reflection.getType(),
|
|
374
|
-
default: arg.default,
|
|
375
|
-
tags: {
|
|
376
|
-
...arg.reflection.getTags(),
|
|
377
|
-
alias: arg.alias.filter(__assignType((alias) => alias.length > 1, [
|
|
378
|
-
"alias",
|
|
379
|
-
"",
|
|
380
|
-
"P\"2!\"/\""
|
|
381
|
-
])).map(__assignType((alias) => (0, __stryke_string_format_constant_case.constantCase)(alias), [
|
|
382
|
-
"alias",
|
|
383
|
-
"",
|
|
384
|
-
"P\"2!\"/\""
|
|
385
|
-
])),
|
|
386
|
-
domain: "cli"
|
|
387
|
-
}
|
|
388
|
-
}), [
|
|
389
|
-
"arg",
|
|
390
|
-
"",
|
|
391
|
-
"P\"2!\"/\""
|
|
392
|
-
]));
|
|
393
|
-
}
|
|
394
|
-
for (const input of context.inputs.filter(__assignType((input$1) => input$1.segments.filter(__assignType((segment) => !require_plugin_utils_context_helpers.isDynamicPathSegment(segment), [
|
|
395
|
-
"segment",
|
|
396
|
-
"",
|
|
397
|
-
"P\"2!\"/\""
|
|
398
|
-
])).length === command.segments.filter(__assignType((segment) => !require_plugin_utils_context_helpers.isDynamicPathSegment(segment), [
|
|
399
|
-
"segment",
|
|
400
|
-
"",
|
|
401
|
-
"P\"2!\"/\""
|
|
402
|
-
])).length + 1 && input$1.segments.slice(0, command.segments.length).every(__assignType((value, index) => value === command.segments[index], [
|
|
403
|
-
"value",
|
|
404
|
-
"index",
|
|
405
|
-
"",
|
|
406
|
-
"P\"2!\"2\"\"/#"
|
|
407
|
-
])), [
|
|
408
|
-
"input",
|
|
409
|
-
"",
|
|
410
|
-
"P\"2!\"/\""
|
|
411
|
-
]))) tree.children[input.name] = await reflectCommandTree(context, input, tree);
|
|
412
|
-
return tree;
|
|
413
|
-
}
|
|
414
|
-
reflectCommandTree.__type = [
|
|
415
|
-
"context",
|
|
416
|
-
"CommandInput",
|
|
417
|
-
"command",
|
|
418
|
-
"CommandTree",
|
|
419
|
-
"parent",
|
|
420
|
-
"reflectCommandTree",
|
|
421
|
-
"P\"2!\"w\"2#\"w$2%8\"w$`/&"
|
|
422
|
-
];
|
|
423
|
-
|
|
424
|
-
//#endregion
|
|
425
|
-
exports.findCommandsRoot = findCommandsRoot;
|
|
426
|
-
exports.reflectCommandTree = reflectCommandTree;
|
|
427
|
-
exports.resolveCommandId = resolveCommandId;
|
|
428
|
-
exports.resolveCommandName = resolveCommandName;
|
|
429
|
-
exports.resolveCommandPath = resolveCommandPath;
|
|
430
|
-
//# sourceMappingURL=resolve-command.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-command.cjs","names":[],"sources":["../../src/helpers/resolve-command.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 { esbuildPlugin } from \"@powerlines/deepkit/esbuild-plugin\";\nimport type {\n ReflectionParameter,\n ReflectionProperty,\n TypeArray\n} from \"@powerlines/deepkit/vendor/type\";\nimport {\n reflect,\n ReflectionClass,\n ReflectionFunction,\n ReflectionKind,\n ReflectionVisibility,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { resolveModule } from \"@powerlines/plugin-esbuild/helpers/resolve\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { commonPath } from \"@stryke/path/common\";\nimport { findFilePath, findFolderName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { stripStars } from \"@stryke/path/normalize\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { existsSync } from \"node:fs\";\nimport { isTypeDefinition } from \"powerlines/utils\";\nimport {\n getAppTitle,\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n isPathSegmentGroup\n} from \"../plugin-utils/context-helpers\";\nimport type {\n CommandArgument,\n CommandInput,\n CommandModule,\n CommandOption,\n CommandTree,\n NumberCommandArgument,\n NumberCommandOption,\n StringCommandArgument,\n StringCommandOption\n} from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { getDefaultOptions } from \"./utilities\";\n\n/**\n * Resolves the description for a command option based on its reflection.\n *\n * @param name - The name of the command option.\n * @param kind - The reflection kind of the command option.\n * @param optional - Whether the command option is optional.\n * @param variadic - Whether the command option is variadic (i.e., an array).\n * @param title - The title of the command option, if any.\n * @param defaultValue - The default value of the command option, if any.\n * @returns The resolved description for the command option.\n */\nexport function resolveCommandOptionDescription(\n name: string,\n kind: ReflectionKind,\n optional = false,\n variadic = false,\n title?: string,\n defaultValue?: any\n): string {\n return `A${optional && !defaultValue ? \"n optional\" : \"\"} command-line ${\n kind === ReflectionKind.boolean ? \"flag\" : \"option\"\n } that allows the user to ${\n kind === ReflectionKind.boolean\n ? \"set the\"\n : variadic\n ? \"specify custom\"\n : \"specify a custom\"\n } ${title?.trim() || titleCase(name)} ${\n kind === ReflectionKind.boolean\n ? \"indicator\"\n : `${kind === ReflectionKind.number ? \"numeric\" : \"string\"} value${\n variadic ? \"s\" : \"\"\n }`\n }.`;\n}\n\n/**\n * Resolves the description for a command argument based on its reflection.\n *\n * @param name - The name of the command argument.\n * @param kind - The reflection kind of the command argument.\n * @param optional - Whether the command argument is optional.\n * @param variadic - Whether the command argument is variadic (i.e., an array).\n * @param title - The title of the command argument, if any.\n * @param defaultValue - The default value of the command argument, if any.\n * @returns The resolved description for the command argument.\n */\nexport function resolveCommandArgumentDescription(\n name: string,\n kind: ReflectionKind,\n optional = false,\n variadic = false,\n title?: string,\n defaultValue?: any\n): string {\n return `An${\n optional && !defaultValue ? \" optional\" : \"\"\n } argument that allows the user to ${\n kind === ReflectionKind.boolean\n ? \"set the\"\n : variadic\n ? \"specify custom\"\n : \"specify a custom\"\n } ${title?.trim() || titleCase(name)} ${\n kind === ReflectionKind.boolean\n ? \"indicator\"\n : `${kind === ReflectionKind.number ? \"numeric\" : \"string\"} value${\n variadic ? \"s\" : \"\"\n }`\n }.`;\n}\n\nexport function resolveCommandId(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(p => Boolean(p) && !isDynamicPathSegment(p))\n .join(\"/\")\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .replaceAll(\"/\", \"-\");\n}\n\n/**\n * Finds the command name from the given file path.\n *\n * @param file - The file path to extract the command name from.\n * @returns The command name.\n */\nexport function resolveCommandName(file: string) {\n let path = findFilePath(file);\n let name = findFolderName(file, {\n requireExtension: true\n });\n\n while (isDynamicPathSegment(name)) {\n path = resolveParentPath(path);\n name = findFolderName(path, {\n requireExtension: true\n });\n }\n\n return name;\n}\n\nexport function resolveCommandPath(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .split(\"/\")\n .filter(path => path && !isPathSegmentGroup(path))\n .join(\"/\");\n}\n\nexport function resolveCommandDynamicPathSegments(\n context: Context,\n file: string\n): string[] {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(path => Boolean(path) && isDynamicPathSegment(path))\n .map(path => getDynamicPathSegmentName(path));\n}\n\nexport function findCommandsRoot(context: Context): string {\n if (isSetString(context.config.input)) {\n return appendPath(\n appendPath(stripStars(context.config.input), context.config.root),\n context.workspaceConfig.workspaceRoot\n );\n } else if (isTypeDefinition(context.config.input)) {\n return appendPath(\n appendPath(stripStars(context.config.input.file), context.config.root),\n context.workspaceConfig.workspaceRoot\n );\n } else if (\n Array.isArray(context.config.input) &&\n context.config.input.length > 0\n ) {\n return commonPath(\n context.config.input.map(input =>\n appendPath(\n appendPath(\n stripStars(isSetString(input) ? input : input.file),\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n );\n } else if (isSetObject(context.config.input)) {\n return commonPath(\n Object.values(context.config.input).map(input =>\n Array.isArray(input)\n ? commonPath(\n input.map(i =>\n appendPath(\n appendPath(\n stripStars(isSetString(i) ? i : i.file),\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n : appendPath(\n appendPath(\n stripStars(isSetString(input) ? input : input.file),\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n );\n }\n\n let commandsPath = joinPaths(context.config.root, \"src/commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"src\");\n if (!existsSync(commandsPath)) {\n commandsPath = context.config.root;\n }\n }\n }\n\n return appendPath(commandsPath, context.workspaceConfig.workspaceRoot);\n}\n\n/**\n * Extracts command parameter information from a type parameter reflection.\n *\n * @param command - The command tree to which the parameter belongs.\n * @param reflection - The type parameter reflection to extract information from.\n * @returns The extracted command option information.\n */\nexport function extractCommandOption(\n command: CommandInput,\n reflection: ReflectionProperty\n): CommandOption {\n const type = reflection.getType();\n\n const option = {\n name: reflection.getNameAsString(),\n alias: reflection.getTags().alias ?? [],\n title:\n reflection.getTags().title?.trim() ||\n titleCase(reflection.getNameAsString()),\n description:\n reflection.getDescription() ||\n resolveCommandOptionDescription(\n reflection.getNameAsString(),\n reflection.getKind(),\n reflection.isOptional(),\n reflection.isArray(),\n reflection.getTags().title,\n reflection.getDefaultValue()\n ),\n env: constantCase(reflection.getNameAsString()),\n kind: type.kind as\n | ReflectionKind.string\n | ReflectionKind.number\n | ReflectionKind.boolean,\n optional: reflection.isOptional(),\n default: reflection.getDefaultValue(),\n variadic: reflection.isArray(),\n reflection\n } as CommandOption;\n\n if (reflection.isArray()) {\n if (\n (type as TypeArray).type.kind === ReflectionKind.string ||\n (type as TypeArray).type.kind === ReflectionKind.number\n ) {\n (option as StringCommandOption | NumberCommandOption).variadic = true;\n (option as StringCommandOption | NumberCommandOption).kind = (\n type as TypeArray\n ).type.kind as ReflectionKind.string | ReflectionKind.number;\n } else {\n throw new Error(\n `Unsupported array type for option \"${reflection.getNameAsString()}\" in command \"${\n command.name\n }\". Only string[] and number[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n } else if (\n type.kind !== ReflectionKind.boolean &&\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number\n ) {\n throw new Error(\n `Unsupported type for option \"${reflection.getNameAsString()}\" in command \"${\n command.name\n }\". Only string, number, boolean, string[] and number[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n return option;\n}\n\n/**\n * Extracts command positional argument information from a type parameter reflection.\n *\n * @param command - The command tree to which the parameter belongs.\n * @param reflection - The type parameter reflection to extract information from.\n * @returns The extracted command positional argument information.\n */\nexport function extractCommandArgument(\n command: CommandInput,\n reflection: ReflectionParameter\n): CommandArgument {\n const type = reflection.getType();\n\n if (\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number &&\n type.kind !== ReflectionKind.boolean &&\n !(\n type.kind === ReflectionKind.array &&\n (type.type.kind === ReflectionKind.string ||\n type.type.kind === ReflectionKind.number)\n )\n ) {\n throw new Error(\n `Unsupported type for argument \"${reflection.getName()}\" in command \"${\n command.name\n }\". Only string types (or an array of strings) are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n const argument = {\n name: reflection.getName(),\n alias: reflection.getAlias(),\n kind: type.kind,\n title: titleCase(reflection.getName()),\n description:\n reflection.parameter.description ||\n resolveCommandArgumentDescription(\n reflection.getName(),\n type.kind === ReflectionKind.array ? type.type.kind : type.kind,\n reflection.isOptional(),\n type.kind === ReflectionKind.array,\n titleCase(reflection.getName()),\n reflection.getDefaultValue()\n ),\n env: constantCase(reflection.getName()),\n optional: reflection.isOptional(),\n default: reflection.getDefaultValue(),\n reflection\n } as CommandArgument;\n\n if (type.kind === ReflectionKind.array) {\n if (\n type.type.kind === ReflectionKind.string ||\n type.type.kind === ReflectionKind.number\n ) {\n (argument as StringCommandArgument | NumberCommandArgument).variadic =\n true;\n (argument as StringCommandArgument | NumberCommandArgument).kind =\n type.type.kind;\n } else {\n throw new Error(\n `Unsupported array type for argument \"${reflection.getName()}\" in command \"${\n command.name\n }\". Only string[] and number[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n } else if (\n type.kind !== ReflectionKind.boolean &&\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number\n ) {\n throw new Error(\n `Unsupported type for argument \"${reflection.getName()}\" in command \"${\n command.name\n }\". Only string, number, boolean, string[] and number[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n return argument;\n}\n\n/**\n * Reflects the command tree for a given command input.\n *\n * @param context - The context in which the command is being reflected.\n * @param command - The command input to reflect.\n * @param parent - The parent command tree, if any.\n * @returns The reflected command tree.\n */\nexport async function reflectCommandTree<TContext extends Context = Context>(\n context: TContext,\n command: CommandInput,\n parent?: CommandTree\n): Promise<CommandTree> {\n const title =\n command.title ||\n `${\n parent?.title\n ? `${\n parent.isVirtual\n ? parent.title.replace(/(?:c|C)ommands?$/, \"\").trim()\n : parent.title\n } - `\n : \"\"\n }${titleCase(command.name)}${command.isVirtual ? \" Commands\" : \"\"}`;\n\n const tree = {\n alias: [],\n icon: parent?.icon,\n ...command,\n title,\n options: getDefaultOptions(context, command),\n arguments: [],\n parent: parent ?? null,\n children: {},\n reflection: null\n } as CommandTree;\n\n if (!command.isVirtual) {\n if (\n !command.entry.input?.file ||\n !context.fs.existsSync(command.entry.input.file)\n ) {\n throw new Error(\n `${\n !command.entry.input?.file ? \"Missing\" : \"Non-existent\"\n } command entry file for \"${command.name}\"`\n );\n }\n\n context.debug(\n `Adding reflection for user-defined command: ${command.id} (file: ${\n command.entry.input.file\n })`\n );\n\n const resolved = await resolveModule<CommandModule>(\n context,\n command.entry.input,\n {\n plugins: [\n esbuildPlugin(context, {\n reflection: \"default\",\n reflectionLevel: \"verbose\"\n })\n ]\n }\n );\n\n const metadata = resolved.metadata ?? {};\n if (isSetString(metadata.title)) {\n tree.title = metadata.title;\n }\n if (isSetString(metadata.description)) {\n tree.description = metadata.description;\n }\n if (\n isSetString(metadata.alias) ||\n (Array.isArray(metadata.alias) && metadata.alias.length > 0)\n ) {\n tree.alias = toArray(metadata.alias);\n }\n if (isSetString(metadata.icon)) {\n tree.icon = metadata.icon;\n }\n\n const type = reflect(resolved);\n if (type.kind !== ReflectionKind.function) {\n throw new Error(\n `The command entry file \"${command.entry.input.file}\" does not export a valid function.`\n );\n }\n\n tree.reflection = new ReflectionFunction(type);\n tree.description ??=\n command.description ||\n type.description ||\n `The ${tree.title.replace(/(?:c|C)ommands?$/, \"\").trim()} executable command-line interface.`;\n\n const parameters = tree.reflection.getParameters();\n if (parameters.length > 0 && parameters[0]) {\n if (\n parameters[0].type.kind === ReflectionKind.objectLiteral ||\n parameters[0].type.kind === ReflectionKind.class\n ) {\n const optionsReflection = ReflectionClass.from(parameters[0].type);\n for (const propertyReflection of optionsReflection.getProperties()) {\n tree.options[propertyReflection.getNameAsString()] =\n extractCommandOption(command, propertyReflection);\n }\n } else {\n throw new Error(\n `The first parameter of the command handler function in \"${\n command.entry.input.file\n }\" must be an object literal or class type representing the command options.`\n );\n }\n\n tree.arguments = parameters\n .slice(1)\n .map(arg => extractCommandArgument(command, arg));\n\n // Ensure unique argument names by appending an index suffix to duplicates\n tree.arguments.forEach((argument, index) => {\n const found = tree.arguments.findIndex(\n arg => arg.name === argument.name\n );\n if (\n (found !== -1 && found !== index) ||\n tree.segments.some(\n segment =>\n isDynamicPathSegment(segment) &&\n getDynamicPathSegmentName(segment) === argument.name\n )\n ) {\n argument.name += `_${\n tree.segments.filter(\n segment =>\n isDynamicPathSegment(segment) &&\n getDynamicPathSegmentName(segment).replace(/_\\d+$/, \"\") ===\n argument.name\n ).length +\n tree.arguments.filter(\n arg => arg.name.replace(/_\\d+$/, \"\") === argument.name\n ).length\n }`;\n argument.env = constantCase(argument.name);\n }\n });\n }\n } else {\n tree.description ??= `A collection of available ${\n tree.title.replace(/(?:c|C)ommands?$/, \"\").trim() || titleCase(tree.name)\n } commands that are included in the ${getAppTitle(\n context\n )} command-line application.`;\n }\n\n if (context.env) {\n if (isSetObject(tree.options)) {\n Object.values(tree.options)\n .filter(option => option.env !== false)\n .forEach(option => {\n context.env.types.env.addProperty({\n name: option.env as string,\n optional: option.optional ? true : undefined,\n description: option.description,\n visibility: ReflectionVisibility.public,\n type:\n option.reflection?.getType() ??\n ((option as StringCommandOption | NumberCommandOption).variadic\n ? { kind: ReflectionKind.array, type: { kind: option.kind } }\n : { kind: option.kind }),\n default: option.default,\n tags: {\n ...option.reflection?.getTags(),\n title: option.title,\n alias: option.alias\n .filter(alias => alias.length > 1)\n .map(alias => constantCase(alias)),\n domain: \"cli\"\n }\n });\n });\n }\n\n tree.arguments\n .filter(arg => arg.env !== false)\n .forEach(arg =>\n context.env.types.env.addProperty({\n name: arg.env as string,\n optional: arg.optional ? true : undefined,\n description: arg.description,\n visibility: ReflectionVisibility.public,\n type: arg.reflection.getType(),\n default: arg.default,\n tags: {\n ...arg.reflection.getTags(),\n alias: arg.alias\n .filter(alias => alias.length > 1)\n .map(alias => constantCase(alias)),\n domain: \"cli\"\n }\n })\n );\n }\n\n for (const input of context.inputs.filter(\n input =>\n input.segments.filter(segment => !isDynamicPathSegment(segment))\n .length ===\n command.segments.filter(segment => !isDynamicPathSegment(segment))\n .length +\n 1 &&\n input.segments\n .slice(0, command.segments.length)\n .every((value, index) => value === command.segments[index])\n )) {\n tree.children[input.name] = await reflectCommandTree(context, input, tree);\n }\n\n return tree;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;;;;;AAiDX,SAAY,gCAAA,MAAA,MAAA,WAAA,OAAA,WAAA,OAAA,OAAA,cAAA;AACR,QAAO,IAAI,YAAE,CAAA,eAAA,eAAA,GAAA,gBAAA,SAAA,gDAAA,UAAA,SAAA,SAAA,2BAAA,SAAA,gDAAA,UACP,YACA,WACI,mBACD,mBAAA,GAAA,OAAA,MAAA,qDAAA,KAAA,CAAA,GAAA,SAAA,gDAAA,UACH,cACA,GAAG,SAAQ,gDAAA,SAAA,YAAA,SAAA,QAAA,WAAA,MAAA,KAAA;;AAErB,gCAAoB,SAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;;;;;AAYpB,SAAgB,kCAAkC,MAAM,MAAC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