@shell-shock/core 0.6.0 → 0.7.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.
Files changed (39) hide show
  1. package/dist/components/docs.d.cts +5 -5
  2. package/dist/components/docs.d.mts +5 -5
  3. package/dist/components/index.cjs +2 -0
  4. package/dist/components/index.d.cts +2 -2
  5. package/dist/components/index.d.mts +2 -2
  6. package/dist/components/index.mjs +2 -2
  7. package/dist/components/options-parser-logic.cjs +111 -10
  8. package/dist/components/options-parser-logic.cjs.map +1 -1
  9. package/dist/components/options-parser-logic.d.cts +39 -8
  10. package/dist/components/options-parser-logic.d.cts.map +1 -1
  11. package/dist/components/options-parser-logic.d.mts +32 -1
  12. package/dist/components/options-parser-logic.d.mts.map +1 -1
  13. package/dist/components/options-parser-logic.mjs +110 -11
  14. package/dist/components/options-parser-logic.mjs.map +1 -1
  15. package/dist/components/usage.cjs +6 -5
  16. package/dist/components/usage.cjs.map +1 -1
  17. package/dist/components/usage.d.cts +2 -4
  18. package/dist/components/usage.d.cts.map +1 -1
  19. package/dist/components/usage.d.mts +2 -4
  20. package/dist/components/usage.d.mts.map +1 -1
  21. package/dist/components/usage.mjs +6 -5
  22. package/dist/components/usage.mjs.map +1 -1
  23. package/dist/helpers/persistence.cjs +48 -3
  24. package/dist/helpers/persistence.cjs.map +1 -1
  25. package/dist/helpers/persistence.mjs +48 -3
  26. package/dist/helpers/persistence.mjs.map +1 -1
  27. package/dist/helpers/resolve-command.cjs +90 -29
  28. package/dist/helpers/resolve-command.cjs.map +1 -1
  29. package/dist/helpers/resolve-command.mjs +91 -30
  30. package/dist/helpers/resolve-command.mjs.map +1 -1
  31. package/dist/index.d.cts +2 -2
  32. package/dist/index.d.mts +2 -2
  33. package/dist/types/command.d.cts +272 -7
  34. package/dist/types/command.d.cts.map +1 -1
  35. package/dist/types/command.d.mts +272 -7
  36. package/dist/types/command.d.mts.map +1 -1
  37. package/dist/types/index.d.cts +2 -2
  38. package/dist/types/index.d.mts +2 -2
  39. package/package.json +3 -3
@@ -1,94 +1,359 @@
1
- import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
1
+ import { ReflectionFunction, ReflectionKind, ReflectionParameter, ReflectionProperty, SerializedTypes } from "@powerlines/deepkit/vendor/type";
2
2
  import { AnyFunction } from "@stryke/types/base";
3
3
  import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
4
4
 
5
5
  //#region src/types/command.d.ts
6
- interface BaseCommandOption {
6
+ interface BaseCommandArgument {
7
+ /**
8
+ * The option name.
9
+ */
7
10
  name: string;
11
+ /**
12
+ * The option kind.
13
+ */
8
14
  kind: ReflectionKind;
15
+ /**
16
+ * The display title.
17
+ */
9
18
  title: string;
19
+ /**
20
+ * The option description.
21
+ */
10
22
  description: string;
23
+ /**
24
+ * Alternative option names.
25
+ */
11
26
  alias: string[];
27
+ /**
28
+ * The environment variable name or false to disable.
29
+ */
12
30
  env: string | false;
31
+ /**
32
+ * Whether the option is optional.
33
+ */
13
34
  optional: boolean;
14
35
  }
15
- interface StringCommandOption extends BaseCommandOption {
36
+ interface StringCommandArgument extends BaseCommandArgument {
37
+ /**
38
+ * The option kind.
39
+ */
16
40
  kind: ReflectionKind.string;
41
+ /**
42
+ * The default value.
43
+ */
17
44
  default?: string;
45
+ /**
46
+ * Whether the option accepts multiple values.
47
+ */
18
48
  variadic: boolean;
19
49
  }
20
- interface NumberCommandOption extends BaseCommandOption {
50
+ interface NumberCommandArgument extends BaseCommandArgument {
51
+ /**
52
+ * The option kind.
53
+ */
21
54
  kind: ReflectionKind.number;
55
+ /**
56
+ * The default value.
57
+ */
22
58
  default?: number;
59
+ /**
60
+ * Whether the option accepts multiple values.
61
+ */
23
62
  variadic: boolean;
24
63
  }
25
- interface BooleanCommandOption extends BaseCommandOption {
64
+ interface BooleanCommandArgument extends BaseCommandArgument {
65
+ /**
66
+ * The option kind.
67
+ */
26
68
  kind: ReflectionKind.boolean;
69
+ /**
70
+ * The default value.
71
+ */
27
72
  default?: boolean;
73
+ /**
74
+ * The option this negates.
75
+ */
28
76
  isNegativeOf?: string;
77
+ /**
78
+ * Whether to skip adding a negative option.
79
+ */
80
+ skipAddingNegative?: boolean;
81
+ }
82
+ interface StringCommandOption extends StringCommandArgument {
83
+ /**
84
+ * The property reflection.
85
+ */
86
+ reflection?: ReflectionProperty;
87
+ }
88
+ interface NumberCommandOption extends NumberCommandArgument {
89
+ /**
90
+ * The property reflection.
91
+ */
92
+ reflection?: ReflectionProperty;
93
+ }
94
+ interface BooleanCommandOption extends BooleanCommandArgument {
95
+ /**
96
+ * The property reflection.
97
+ */
98
+ reflection?: ReflectionProperty;
99
+ /**
100
+ * The option this negates.
101
+ */
102
+ isNegativeOf?: string;
103
+ /**
104
+ * Whether to skip adding a negative option.
105
+ */
29
106
  skipAddingNegative?: boolean;
30
107
  }
31
108
  type CommandOption = StringCommandOption | NumberCommandOption | BooleanCommandOption;
109
+ interface StringCommandParameter extends StringCommandArgument {
110
+ /**
111
+ * The parameter reflection.
112
+ */
113
+ reflection: ReflectionParameter;
114
+ }
115
+ interface NumberCommandParameter extends NumberCommandArgument {
116
+ /**
117
+ * The parameter reflection.
118
+ */
119
+ reflection: ReflectionParameter;
120
+ }
121
+ interface BooleanCommandParameter extends BooleanCommandArgument {
122
+ /**
123
+ * The parameter reflection.
124
+ */
125
+ reflection: ReflectionParameter;
126
+ }
127
+ type CommandParameter = StringCommandParameter | NumberCommandParameter | BooleanCommandParameter;
32
128
  interface CommandPath {
129
+ /**
130
+ * The full path value.
131
+ */
33
132
  value: string | null;
133
+ /**
134
+ * The path segments.
135
+ */
34
136
  segments: string[];
35
137
  }
36
138
  interface CommandBase {
139
+ /**
140
+ * The command id.
141
+ */
37
142
  id: string | null;
143
+ /**
144
+ * The command name.
145
+ */
38
146
  name: string;
147
+ /**
148
+ * The display title.
149
+ */
39
150
  title?: string;
151
+ /**
152
+ * The command description.
153
+ */
40
154
  description?: string;
155
+ /**
156
+ * Alternative command names.
157
+ */
41
158
  alias?: string[];
159
+ /**
160
+ * The command icon.
161
+ */
162
+ icon?: string;
163
+ /**
164
+ * The command path.
165
+ */
42
166
  path: CommandPath;
167
+ /**
168
+ * Whether the command is virtual.
169
+ */
43
170
  isVirtual: boolean;
44
171
  }
45
172
  interface CommandInput extends CommandBase {
173
+ /**
174
+ * The command id.
175
+ */
46
176
  id: string;
177
+ /**
178
+ * The resolved entry definition.
179
+ */
47
180
  entry: ResolvedEntryTypeDefinition;
48
181
  }
182
+ /**
183
+ * Represents a dynamic command segment with metadata and matching behavior.
184
+ */
49
185
  type CommandDynamicSegment = {
186
+ /**
187
+ * The parameter reflection.
188
+ */
189
+ reflection?: ReflectionParameter;
190
+ /**
191
+ * The segment value.
192
+ */
193
+ segment: string;
194
+ /**
195
+ * The segment name.
196
+ */
50
197
  name: string;
198
+ /**
199
+ * The segment title.
200
+ */
51
201
  title: string;
202
+ /**
203
+ * The segment description.
204
+ */
52
205
  description: string;
206
+ /**
207
+ * Whether the segment is optional.
208
+ */
53
209
  optional: boolean;
54
210
  } & ({
211
+ /**
212
+ * The default value.
213
+ */
55
214
  default?: string;
215
+ /**
216
+ * Whether the segment is a catch-all.
217
+ */
56
218
  catchAll: false;
219
+ /**
220
+ * Whether the segment is variadic.
221
+ */
57
222
  variadic: false;
58
223
  } | {
224
+ /**
225
+ * The default value.
226
+ */
59
227
  default?: string;
228
+ /**
229
+ * Whether the segment is a catch-all.
230
+ */
60
231
  catchAll: true;
232
+ /**
233
+ * Whether the segment is variadic.
234
+ */
61
235
  variadic: false;
62
236
  } | {
237
+ /**
238
+ * The default values.
239
+ */
63
240
  default?: string[];
241
+ /**
242
+ * Whether the segment is a catch-all.
243
+ */
64
244
  catchAll: true;
245
+ /**
246
+ * Whether the segment is variadic.
247
+ */
65
248
  variadic: true;
66
249
  });
67
250
  interface CommandTreePath extends CommandPath {
251
+ /**
252
+ * Dynamic segment definitions.
253
+ */
68
254
  dynamics: Record<string, CommandDynamicSegment>;
69
255
  }
70
256
  type CommandTree = CommandInput & {
257
+ /**
258
+ * The display title.
259
+ */
71
260
  title: string;
261
+ /**
262
+ * The command description.
263
+ */
72
264
  description: string;
265
+ /**
266
+ * Alternative command names.
267
+ */
73
268
  alias: string[];
269
+ /**
270
+ * The command path with dynamics.
271
+ */
74
272
  path: CommandTreePath;
273
+ /**
274
+ * The command options.
275
+ */
75
276
  options: Record<string, CommandOption>;
277
+ /**
278
+ * The positional parameter options provided to the command.
279
+ */
280
+ params: CommandParameter[];
281
+ /**
282
+ * The parent command.
283
+ */
76
284
  parent: null | CommandTree;
285
+ /**
286
+ * Child commands.
287
+ */
77
288
  children: Record<string, CommandTree>;
289
+ /**
290
+ * The command handler reflection.
291
+ */
292
+ reflection: ReflectionFunction | null;
293
+ };
294
+ type SerializedCommandOption = Omit<CommandOption, "reflection">;
295
+ type SerializedCommandDynamicSegment = Omit<CommandDynamicSegment, "reflection">;
296
+ type SerializedCommandTreePath = Omit<CommandTreePath, "dynamics"> & {
297
+ dynamics: Record<string, SerializedCommandDynamicSegment>;
78
298
  };
79
- type SerializedCommandTree = Omit<CommandTree, "parent" | "children"> & {
299
+ type SerializedCommandParameter = Omit<CommandParameter, "reflection">;
300
+ type SerializedCommandTree = Omit<CommandTree, "options" | "path" | "params" | "parent" | "children" | "reflection"> & {
301
+ /**
302
+ * The command options.
303
+ */
304
+ options: Record<string, SerializedCommandOption>;
305
+ /**
306
+ * The command path with dynamics.
307
+ */
308
+ path: SerializedCommandTreePath;
309
+ /**
310
+ * The positional parameter options provided to the command.
311
+ */
312
+ params: SerializedCommandParameter[];
313
+ /**
314
+ * The parent command id.
315
+ */
80
316
  parent: null | string;
317
+ /**
318
+ * Serialized child commands.
319
+ */
81
320
  children: Record<string, SerializedCommandTree>;
321
+ /**
322
+ * The command handler reflection.
323
+ */
324
+ reflection?: SerializedTypes;
82
325
  };
83
326
  interface Metadata {
327
+ /**
328
+ * The display name of the command.
329
+ *
330
+ * @remarks
331
+ * This value will be used in various displays of the user interface and documentation. If not provided, a formatted value of the command name will be used.
332
+ */
84
333
  title?: string;
334
+ /**
335
+ * A brief description of what the command does.
336
+ *
337
+ * @remarks
338
+ * This value will be used in various displays of the user interface and documentation. If not provided, a default message may be shown.
339
+ */
85
340
  description?: string;
341
+ /**
342
+ * One or more alternative names for the command.
343
+ */
86
344
  alias?: string | string[];
345
+ /**
346
+ * An optional icon to visually represent the command in user interfaces.
347
+ *
348
+ * @remarks
349
+ * This can be a string containing an emoji, a Unicode character, or any other symbol that helps to visually identify the command. If not provided, no icon will be displayed.
350
+ */
351
+ icon?: string;
87
352
  }
88
353
  interface CommandModule {
89
354
  metadata?: Metadata;
90
355
  default?: AnyFunction;
91
356
  }
92
357
  //#endregion
93
- export { BaseCommandOption, BooleanCommandOption, CommandBase, CommandDynamicSegment, CommandInput, CommandModule, CommandOption, CommandPath, CommandTree, CommandTreePath, Metadata, NumberCommandOption, SerializedCommandTree, StringCommandOption };
358
+ export { BaseCommandArgument, BooleanCommandArgument, BooleanCommandOption, BooleanCommandParameter, CommandBase, CommandDynamicSegment, CommandInput, CommandModule, CommandOption, CommandParameter, CommandPath, CommandTree, CommandTreePath, Metadata, NumberCommandArgument, NumberCommandOption, NumberCommandParameter, SerializedCommandDynamicSegment, SerializedCommandOption, SerializedCommandParameter, SerializedCommandTree, SerializedCommandTreePath, StringCommandArgument, StringCommandOption, StringCommandParameter };
94
359
  //# sourceMappingURL=command.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.cts","names":[],"sources":["../../src/types/command.ts"],"sourcesContent":[],"mappings":";;;;;UAsBiB,iBAAA;;EAAA,IAAA,EAET,cAF0B;EAUjB,KAAA,EAAA,MAAA;EAMA,WAAA,EAAA,MAAA;EAMA,KAAA,EAAA,MAAA,EAAA;EAOL,GAAA,EAAA,MAAA,GAAA,KAAa;EACrB,QAAA,EAAA,OAAA;;AAEA,UAtBa,mBAAA,SAA4B,iBAsBzC,CAAA;EAAoB,IAAA,EArBhB,cAAA,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