@navios/commander 1.0.0 → 1.2.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 (76) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +22 -0
  3. package/dist/src/commander.factory.d.mts +59 -0
  4. package/dist/src/commander.factory.d.mts.map +1 -1
  5. package/dist/src/commands/help.command.d.mts.map +1 -1
  6. package/dist/src/decorators/command.decorator.d.mts +9 -2
  7. package/dist/src/decorators/command.decorator.d.mts.map +1 -1
  8. package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts +26 -0
  9. package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts.map +1 -0
  10. package/dist/src/legacy-compat/decorators/command.decorator.d.mts +34 -0
  11. package/dist/src/legacy-compat/decorators/command.decorator.d.mts.map +1 -0
  12. package/dist/src/legacy-compat/decorators/index.d.mts +3 -0
  13. package/dist/src/legacy-compat/decorators/index.d.mts.map +1 -0
  14. package/dist/src/legacy-compat/index.d.mts +28 -0
  15. package/dist/src/legacy-compat/index.d.mts.map +1 -0
  16. package/dist/src/overrides/help.command.d.mts +18 -0
  17. package/dist/src/overrides/help.command.d.mts.map +1 -0
  18. package/dist/src/tokens/help-command.token.d.mts +4 -0
  19. package/dist/src/tokens/help-command.token.d.mts.map +1 -0
  20. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  21. package/dist/tsconfig.tsbuildinfo +1 -1
  22. package/lib/cli-module.decorator-CkP22084.cjs +71 -0
  23. package/lib/cli-module.decorator-CkP22084.cjs.map +1 -0
  24. package/lib/cli-module.decorator-DGuGfpex.d.mts +411 -0
  25. package/lib/cli-module.decorator-DGuGfpex.d.mts.map +1 -0
  26. package/lib/cli-module.decorator-DVl8009Q.d.cts +213 -0
  27. package/lib/cli-module.decorator-DVl8009Q.d.cts.map +1 -0
  28. package/lib/cli-module.decorator-UGbtkRYc.mjs +66 -0
  29. package/lib/cli-module.decorator-UGbtkRYc.mjs.map +1 -0
  30. package/lib/command.decorator-DVLSAqYZ.mjs +135 -0
  31. package/lib/command.decorator-DVLSAqYZ.mjs.map +1 -0
  32. package/lib/command.decorator-UrNJmQN0.cjs +176 -0
  33. package/lib/command.decorator-UrNJmQN0.cjs.map +1 -0
  34. package/lib/help-command.token-C0Kgj60o.mjs +427 -0
  35. package/lib/help-command.token-C0Kgj60o.mjs.map +1 -0
  36. package/lib/help-command.token-CMWYI6em.cjs +438 -0
  37. package/lib/help-command.token-CMWYI6em.cjs.map +1 -0
  38. package/lib/help.command-DQyv6ali.cjs +317 -0
  39. package/lib/help.command-DQyv6ali.cjs.map +1 -0
  40. package/lib/help.command-dtZbhq0w.mjs +318 -0
  41. package/lib/help.command-dtZbhq0w.mjs.map +1 -0
  42. package/lib/index.cjs +45 -627
  43. package/lib/index.cjs.map +1 -1
  44. package/lib/index.d.cts +139 -281
  45. package/lib/index.d.cts.map +1 -1
  46. package/lib/index.d.mts +62 -402
  47. package/lib/index.d.mts.map +1 -1
  48. package/lib/index.mjs +30 -612
  49. package/lib/index.mjs.map +1 -1
  50. package/lib/legacy-compat/index.cjs +108 -0
  51. package/lib/legacy-compat/index.cjs.map +1 -0
  52. package/lib/legacy-compat/index.d.cts +63 -0
  53. package/lib/legacy-compat/index.d.cts.map +1 -0
  54. package/lib/legacy-compat/index.d.mts +63 -0
  55. package/lib/legacy-compat/index.d.mts.map +1 -0
  56. package/lib/legacy-compat/index.mjs +101 -0
  57. package/lib/legacy-compat/index.mjs.map +1 -0
  58. package/package.json +20 -3
  59. package/src/commander.factory.mts +107 -8
  60. package/src/commands/help.command.mts +4 -3
  61. package/src/decorators/command.decorator.mts +17 -8
  62. package/src/legacy-compat/decorators/cli-module.decorator.mts +46 -0
  63. package/src/legacy-compat/decorators/command.decorator.mts +46 -0
  64. package/src/legacy-compat/decorators/index.mts +2 -0
  65. package/src/legacy-compat/index.mts +31 -0
  66. package/src/overrides/help.command.mts +40 -0
  67. package/src/tokens/help-command.token.mts +5 -0
  68. package/tsconfig.json +0 -3
  69. package/tsconfig.spec.json +1 -1
  70. package/tsdown.config.mts +1 -1
  71. package/dist/src/commander.application.d.mts +0 -147
  72. package/dist/src/commander.application.d.mts.map +0 -1
  73. package/dist/src/metadata/cli-module.metadata.d.mts +0 -60
  74. package/dist/src/metadata/cli-module.metadata.d.mts.map +0 -1
  75. package/dist/src/services/module-loader.service.d.mts +0 -74
  76. package/dist/src/services/module-loader.service.d.mts.map +0 -1
package/lib/index.d.mts CHANGED
@@ -1,46 +1,8 @@
1
- import { AbstractAdapterInterface, AdapterEnvironment, AnyInjectableType, ClassType, ClassTypeWithInstance, InjectionToken, LogLevel, ModuleMetadata, NaviosApplication, NaviosModule, Registry } from "@navios/core";
1
+ import { a as CommanderExecutionContext, c as extractCommandMetadata, d as CliAdapterOptions, f as CliEnvironment, i as CommandOptions, l as getCommandMetadata, m as CommandHandler, n as CliModuleOptions, o as CommandMetadata, p as AbstractCliAdapterInterface, r as Command, s as CommandMetadataKey, t as CliModule, u as hasCommandMetadata } from "./cli-module.decorator-DGuGfpex.mjs";
2
+ import { AnyInjectableType, ClassType, ClassTypeWithInstance, InjectionToken, LogLevel, ModuleMetadata, NaviosApplication, NaviosModule } from "@navios/core";
2
3
  import { ZodObject, z } from "zod";
3
4
  export * from "@navios/core";
4
5
 
5
- //#region src/interfaces/command-handler.interface.d.mts
6
-
7
- /**
8
- * Interface that all command classes must implement.
9
- *
10
- * Commands decorated with `@Command` must implement this interface.
11
- * The `execute` method is called when the command is invoked.
12
- *
13
- * @template TOptions - The type of options that the command accepts
14
- *
15
- * @example
16
- * ```typescript
17
- * import { Command, CommandHandler } from '@navios/commander'
18
- * import { z } from 'zod'
19
- *
20
- * const optionsSchema = z.object({
21
- * name: z.string()
22
- * })
23
- *
24
- * type Options = z.infer<typeof optionsSchema>
25
- *
26
- * @Command({ path: 'greet', optionsSchema })
27
- * export class GreetCommand implements CommandHandler<Options> {
28
- * async execute(options: Options) {
29
- * console.log(`Hello, ${options.name}!`)
30
- * }
31
- * }
32
- * ```
33
- */
34
- interface CommandHandler<TOptions = any> {
35
- /**
36
- * Executes the command with the provided options.
37
- *
38
- * @param options - The validated command options (validated against the command's schema if provided)
39
- * @returns A promise or void
40
- */
41
- execute(options: TOptions): void | Promise<void>;
42
- }
43
- //#endregion
44
6
  //#region src/commands/help.command.d.mts
45
7
  declare const helpOptionsSchema: z.ZodObject<{
46
8
  command: z.ZodOptional<z.ZodString>;
@@ -57,87 +19,6 @@ declare class HelpCommand implements CommandHandler<HelpOptions> {
57
19
  execute(options: HelpOptions): Promise<void>;
58
20
  }
59
21
  //#endregion
60
- //#region src/interfaces/abstract-cli-adapter.interface.d.mts
61
- /**
62
- * Interface for CLI adapters.
63
- * Extends the base adapter interface with CLI-specific methods.
64
- *
65
- * @public
66
- */
67
- interface AbstractCliAdapterInterface extends AbstractAdapterInterface {
68
- /**
69
- * Run the CLI application with the given arguments.
70
- * Parses arguments and executes the matching command.
71
- *
72
- * @param argv - Command-line arguments array (defaults to `process.argv`)
73
- *
74
- * @example
75
- * ```typescript
76
- * const adapter = app.getAdapter() as AbstractCliAdapterInterface
77
- * await adapter.run(process.argv)
78
- * ```
79
- */
80
- run(argv?: string[]): Promise<void>;
81
- /**
82
- * Execute a command programmatically with the provided options.
83
- *
84
- * @param path - The command path (e.g., 'greet', 'user:create')
85
- * @param options - The command options object
86
- *
87
- * @example
88
- * ```typescript
89
- * await adapter.executeCommand('user:create', {
90
- * name: 'John',
91
- * email: 'john@example.com',
92
- * })
93
- * ```
94
- */
95
- executeCommand(path: string, options: Record<string, unknown>): Promise<void>;
96
- /**
97
- * Get all registered command paths and their class references.
98
- *
99
- * @returns Array of objects containing path and class
100
- *
101
- * @example
102
- * ```typescript
103
- * const commands = adapter.getAllCommands()
104
- * commands.forEach(({ path }) => console.log(path))
105
- * ```
106
- */
107
- getAllCommands(): Array<{
108
- path: string;
109
- class: unknown;
110
- }>;
111
- }
112
- //#endregion
113
- //#region src/interfaces/environment.interface.d.mts
114
- /**
115
- * Options for configuring the CLI adapter.
116
- *
117
- * @public
118
- */
119
- interface CliAdapterOptions {}
120
- /**
121
- * Environment type definition for CLI adapters.
122
- * Used with NaviosFactory.create<CliEnvironment>() for type-safe CLI applications.
123
- *
124
- * @public
125
- *
126
- * @example
127
- * ```typescript
128
- * import { NaviosFactory } from '@navios/core'
129
- * import { defineCliEnvironment, type CliEnvironment } from '@navios/commander'
130
- *
131
- * const app = await NaviosFactory.create<CliEnvironment>(AppModule, {
132
- * adapter: defineCliEnvironment(),
133
- * })
134
- * ```
135
- */
136
- interface CliEnvironment extends AdapterEnvironment {
137
- options: CliAdapterOptions;
138
- adapter: AbstractCliAdapterInterface;
139
- }
140
- //#endregion
141
22
  //#region src/commander.factory.d.mts
142
23
  /**
143
24
  * Logger display options for CLI applications.
@@ -182,16 +63,75 @@ interface CommanderLoggerOptions {
182
63
  */
183
64
  showTimeDiff?: boolean;
184
65
  }
66
+ /**
67
+ * TUI-specific options for terminal UI mode.
68
+ * Only used when enableTUI is true.
69
+ *
70
+ * @public
71
+ */
72
+ interface CommanderTuiOptions {
73
+ /**
74
+ * Exit on Ctrl+C.
75
+ * @default true
76
+ */
77
+ exitOnCtrlC?: boolean;
78
+ /**
79
+ * Sidebar width in columns.
80
+ */
81
+ sidebarWidth?: number;
82
+ /**
83
+ * Sidebar position.
84
+ */
85
+ sidebarPosition?: 'left' | 'right';
86
+ /**
87
+ * Sidebar header title.
88
+ */
89
+ sidebarTitle?: string;
90
+ /**
91
+ * Auto close after all screens complete successfully.
92
+ * Set to true for default delay (5000ms), or specify delay in milliseconds.
93
+ */
94
+ autoClose?: boolean | number;
95
+ /**
96
+ * Theme preset name ('dark', 'light', 'high-contrast') or custom theme object.
97
+ */
98
+ theme?: string | Record<string, unknown>;
99
+ /**
100
+ * Enable mouse support.
101
+ * @default false
102
+ */
103
+ useMouse?: boolean;
104
+ /**
105
+ * Hide the default console logger screen from the sidebar.
106
+ * @default false
107
+ */
108
+ hideDefaultScreen?: boolean;
109
+ }
185
110
  /**
186
111
  * Configuration options for CommanderFactory.
187
112
  *
188
113
  * @public
189
114
  */
190
115
  interface CommanderFactoryOptions {
116
+ /**
117
+ * Enabled log levels.
118
+ * @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']
119
+ */
120
+ logLevels?: LogLevel[];
191
121
  /**
192
122
  * Logger display options. These override the default CLI-friendly logger settings.
123
+ * Ignored when enableTUI is true.
193
124
  */
194
125
  logger?: CommanderLoggerOptions;
126
+ /**
127
+ * Enable TUI mode with @navios/commander-tui.
128
+ * Requires @navios/commander-tui to be installed.
129
+ */
130
+ enableTUI?: boolean;
131
+ /**
132
+ * TUI-specific options. Only used when enableTUI is true.
133
+ */
134
+ tuiOptions?: CommanderTuiOptions;
195
135
  }
196
136
  /**
197
137
  * Factory class for creating CLI applications.
@@ -247,169 +187,6 @@ declare class CommanderFactory {
247
187
  static create<TModule extends NaviosModule = NaviosModule>(appModule: ClassTypeWithInstance<TModule>, options?: CommanderFactoryOptions): Promise<NaviosApplication<CliEnvironment>>;
248
188
  }
249
189
  //#endregion
250
- //#region src/decorators/command.decorator.d.mts
251
- /**
252
- * Options for the `@Command` decorator.
253
- *
254
- * @public
255
- */
256
- interface CommandOptions {
257
- /**
258
- * The command path that users will invoke from the CLI.
259
- * Can be a single word (e.g., 'greet') or multi-word with colons (e.g., 'user:create', 'db:migrate').
260
- */
261
- path: string;
262
- /**
263
- * Optional description of the command for help text.
264
- * Displayed when users run `help` or `--help`.
265
- */
266
- description?: string;
267
- /**
268
- * Optional Zod schema for validating command options.
269
- * If provided, options will be validated and parsed according to this schema.
270
- */
271
- optionsSchema?: ZodObject;
272
- /**
273
- * Priority level for the command.
274
- * Higher priority commands will be loaded first.
275
- */
276
- priority?: number;
277
- /**
278
- * Registry to use for the command.
279
- * Registry is used to store the command and its options schema.
280
- */
281
- registry?: Registry;
282
- }
283
- /**
284
- * Decorator that marks a class as a CLI command.
285
- *
286
- * The decorated class must implement the `CommandHandler` interface with an `execute` method.
287
- * The command will be automatically registered when its module is loaded.
288
- *
289
- * @param options - Configuration options for the command
290
- * @returns A class decorator function
291
- *
292
- * @example
293
- * ```typescript
294
- * import { Command, CommandHandler } from '@navios/commander'
295
- * import { z } from 'zod'
296
- *
297
- * const optionsSchema = z.object({
298
- * name: z.string(),
299
- * greeting: z.string().optional().default('Hello')
300
- * })
301
- *
302
- * @Command({
303
- * path: 'greet',
304
- * optionsSchema: optionsSchema
305
- * })
306
- * export class GreetCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
307
- * async execute(options) {
308
- * console.log(`${options.greeting}, ${options.name}!`)
309
- * }
310
- * }
311
- * ```
312
- */
313
- declare function Command({
314
- path,
315
- description,
316
- optionsSchema,
317
- priority,
318
- registry
319
- }: CommandOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
320
- //#endregion
321
- //#region src/decorators/cli-module.decorator.d.mts
322
- /**
323
- * Options for the `@CliModule` decorator.
324
- *
325
- * @public
326
- */
327
- interface CliModuleOptions {
328
- /**
329
- * Array or Set of command classes to register in this module.
330
- * Commands must be decorated with `@Command`.
331
- */
332
- commands?: ClassType[] | Set<ClassType>;
333
- /**
334
- * Array or Set of controller classes for HTTP endpoints.
335
- * Allows mixing HTTP and CLI functionality in the same module.
336
- */
337
- controllers?: ClassType[] | Set<ClassType>;
338
- /**
339
- * Array or Set of other modules to import.
340
- * Imported modules' commands and controllers will be available.
341
- */
342
- imports?: ClassType[] | Set<ClassType>;
343
- /**
344
- * Guards to apply to all controllers in this module.
345
- * Guards are executed in reverse order (last guard first).
346
- */
347
- guards?: ClassType[] | Set<ClassType>;
348
- /**
349
- * Service override classes to import for side effects.
350
- * These classes are imported to ensure their @Injectable decorators execute,
351
- * allowing them to register with the DI system. Overrides should use the same
352
- * InjectionToken as the original service with a higher priority.
353
- */
354
- overrides?: ClassType[] | Set<ClassType>;
355
- /**
356
- * Priority level for the module.
357
- * Higher priority modules will be loaded first.
358
- */
359
- priority?: number;
360
- /**
361
- * Registry to use for the module.
362
- * Registry is used to store the module and its commands.
363
- */
364
- registry?: Registry;
365
- }
366
- /**
367
- * Decorator that marks a class as a CLI module.
368
- *
369
- * This decorator extends the standard @Module decorator, adding support for
370
- * CLI commands while maintaining full compatibility with HTTP controllers.
371
- * Modules organize commands and can import other modules to compose larger
372
- * CLI applications.
373
- *
374
- * The module can optionally implement `NaviosModule` interface for lifecycle hooks.
375
- *
376
- * @param options - Configuration options for the module
377
- * @returns A class decorator function
378
- *
379
- * @example
380
- * ```typescript
381
- * import { CliModule } from '@navios/commander'
382
- * import { GreetCommand } from './greet.command'
383
- * import { UserModule } from './user.module'
384
- *
385
- * @CliModule({
386
- * commands: [GreetCommand],
387
- * imports: [UserModule]
388
- * })
389
- * export class AppModule {}
390
- * ```
391
- *
392
- * @example
393
- * ```typescript
394
- * // Mixed HTTP and CLI module
395
- * @CliModule({
396
- * controllers: [HealthController],
397
- * commands: [MigrateCommand],
398
- * imports: [DatabaseModule],
399
- * })
400
- * export class AppModule {}
401
- * ```
402
- */
403
- declare function CliModule({
404
- commands,
405
- controllers,
406
- imports,
407
- guards,
408
- overrides,
409
- priority,
410
- registry
411
- }?: CliModuleOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
412
- //#endregion
413
190
  //#region src/services/commander-adapter.service.d.mts
414
191
  /**
415
192
  * CLI adapter service that implements the AbstractCliAdapterInterface.
@@ -464,69 +241,6 @@ declare class CommanderAdapterService implements AbstractCliAdapterInterface {
464
241
  }>;
465
242
  }
466
243
  //#endregion
467
- //#region src/metadata/command.metadata.d.mts
468
- /**
469
- * @internal
470
- * Symbol key used to store command metadata on classes.
471
- */
472
- declare const CommandMetadataKey: unique symbol;
473
- /**
474
- * Metadata associated with a command.
475
- *
476
- * @public
477
- */
478
- interface CommandMetadata {
479
- /**
480
- * The command path (e.g., 'greet', 'user:create').
481
- */
482
- path: string;
483
- /**
484
- * Optional description of the command for help text.
485
- */
486
- description?: string;
487
- /**
488
- * Optional Zod schema for validating command options.
489
- */
490
- optionsSchema?: ZodObject;
491
- /**
492
- * Map of custom attributes that can be attached to the command.
493
- */
494
- customAttributes: Map<string | symbol, any>;
495
- }
496
- /**
497
- * Gets or creates command metadata for a class.
498
- *
499
- * @internal
500
- * @param target - The command class
501
- * @param context - The decorator context
502
- * @param path - The command path
503
- * @param description - Optional description for help text
504
- * @param optionsSchema - Optional Zod schema
505
- * @returns The command metadata
506
- */
507
- declare function getCommandMetadata(target: ClassType, context: ClassDecoratorContext, path: string, description?: string, optionsSchema?: ZodObject): CommandMetadata;
508
- /**
509
- * Extracts command metadata from a class.
510
- *
511
- * @param target - The command class
512
- * @returns The command metadata
513
- * @throws {Error} If the class is not decorated with @Command
514
- *
515
- * @example
516
- * ```typescript
517
- * const metadata = extractCommandMetadata(GreetCommand)
518
- * console.log(metadata.path) // 'greet'
519
- * ```
520
- */
521
- declare function extractCommandMetadata(target: ClassType): CommandMetadata;
522
- /**
523
- * Checks if a class has command metadata.
524
- *
525
- * @param target - The class to check
526
- * @returns `true` if the class is decorated with @Command, `false` otherwise
527
- */
528
- declare function hasCommandMetadata(target: ClassType): boolean;
529
- //#endregion
530
244
  //#region src/metadata/command-entry.metadata.d.mts
531
245
  /**
532
246
  * Symbol key for storing commands in ModuleMetadata.customEntries.
@@ -748,60 +462,6 @@ declare function defineCliEnvironment(): {
748
462
  tokens: Map<InjectionToken<any, undefined, false>, AnyInjectableType>;
749
463
  };
750
464
  //#endregion
751
- //#region src/interfaces/commander-execution-context.interface.d.mts
752
- /**
753
- * Execution context for a command execution.
754
- *
755
- * Provides access to command metadata, path, and validated options during command execution.
756
- * This context is automatically injected and available via the `CommandExecutionContext` token.
757
- *
758
- * @example
759
- * ```typescript
760
- * import { inject, Injectable } from '@navios/core'
761
- * import { CommandExecutionContext } from '@navios/commander'
762
- *
763
- * @Injectable()
764
- * class CommandLogger {
765
- * private ctx = inject(CommandExecutionContext)
766
- *
767
- * log() {
768
- * console.log('Command:', this.ctx.getCommandPath())
769
- * console.log('Options:', this.ctx.getOptions())
770
- * }
771
- * }
772
- * ```
773
- */
774
- declare class CommanderExecutionContext {
775
- private readonly command;
776
- private readonly commandPath;
777
- private readonly options;
778
- /**
779
- * @internal
780
- * Creates a new execution context.
781
- */
782
- constructor(command: CommandMetadata, commandPath: string, options: any);
783
- /**
784
- * Gets the command metadata.
785
- *
786
- * @returns The command metadata including path and options schema
787
- */
788
- getCommand(): CommandMetadata;
789
- /**
790
- * Gets the command path that was invoked.
791
- *
792
- * @returns The command path (e.g., 'greet', 'user:create')
793
- */
794
- getCommandPath(): string;
795
- /**
796
- * Gets the validated command options.
797
- *
798
- * Options are validated against the command's Zod schema if one was provided.
799
- *
800
- * @returns The validated options object
801
- */
802
- getOptions(): any;
803
- }
804
- //#endregion
805
465
  //#region src/tokens/execution-context.token.d.mts
806
466
  /**
807
467
  * Injection token for accessing the current command execution context.
@@ -828,5 +488,5 @@ declare class CommanderExecutionContext {
828
488
  */
829
489
  declare const CommandExecutionContext: InjectionToken<CommanderExecutionContext, undefined, false>;
830
490
  //#endregion
831
- export { AbstractCliAdapterInterface, CliAdapterOptions, CliEnvironment, CliModule, CliModuleOptions, CliParserService, Command, CommandEntryKey, CommandEntryValue, CommandExecutionContext, CommandHandler, CommandMetadata, CommandMetadataKey, CommandOptions, CommandRegistryService, CommanderAdapterService, CommanderExecutionContext, CommanderFactory, CommanderFactoryOptions, CommanderLoggerOptions, HelpCommand, ParsedCliArgs, RegisteredCommand, defineCliEnvironment, extractCommandMetadata, extractModuleCommands, getCommandMetadata, hasCommandMetadata };
491
+ export { AbstractCliAdapterInterface, CliAdapterOptions, CliEnvironment, CliModule, CliModuleOptions, CliParserService, Command, CommandEntryKey, CommandEntryValue, CommandExecutionContext, CommandHandler, CommandMetadata, CommandMetadataKey, CommandOptions, CommandRegistryService, CommanderAdapterService, CommanderExecutionContext, CommanderFactory, CommanderFactoryOptions, CommanderLoggerOptions, CommanderTuiOptions, HelpCommand, ParsedCliArgs, RegisteredCommand, defineCliEnvironment, extractCommandMetadata, extractModuleCommands, getCommandMetadata, hasCommandMetadata };
832
492
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":["CommandHandler","TOptions","Promise","z","CommandHandler","helpOptionsSchema","ZodString","ZodOptional","core","$strip","ZodObject","HelpOptions","infer","HelpCommand","Promise","AbstractAdapterInterface","AbstractCliAdapterInterface","Promise","Record","Array","AdapterEnvironment","AbstractCliAdapterInterface","CliAdapterOptions","CliEnvironment","ClassTypeWithInstance","LogLevel","NaviosApplication","NaviosModule","CliEnvironment","CommanderLoggerOptions","CommanderFactoryOptions","CommanderFactory","TModule","Promise","ClassType","Registry","ZodObject","CommandOptions","Command","path","description","optionsSchema","priority","registry","ClassDecoratorContext","ClassType","Registry","CliModuleOptions","Set","CliModule","commands","controllers","imports","guards","overrides","priority","registry","ClassDecoratorContext","ClassType","ModuleMetadata","AbstractCliAdapterInterface","CliAdapterOptions","CommanderAdapterService","Promise","Map","Record","Array","ClassType","ZodObject","CommandMetadataKey","CommandMetadata","Map","getCommandMetadata","ClassDecoratorContext","extractCommandMetadata","hasCommandMetadata","ClassType","CommandEntryKey","CommandEntryValue","Set","extractModuleCommands","ClassType","CommandMetadata","RegisteredCommand","CommandRegistryService","Map","Array","ZodObject","ParsedCliArgs","Record","CliParserService","AnyInjectableType","InjectionToken","CommanderAdapterService","CommandRegistryService","CliParserService","defineCliEnvironment","Map","CommandMetadata","CommanderExecutionContext","InjectionToken","CommanderExecutionContext","CommandExecutionContext"],"sources":["../src/interfaces/command-handler.interface.d.mts","../src/commands/help.command.d.mts","../src/interfaces/abstract-cli-adapter.interface.d.mts","../src/interfaces/environment.interface.d.mts","../src/commander.factory.d.mts","../src/decorators/command.decorator.d.mts","../src/decorators/cli-module.decorator.d.mts","../src/services/commander-adapter.service.d.mts","../src/metadata/command.metadata.d.mts","../src/metadata/command-entry.metadata.d.mts","../src/services/command-registry.service.d.mts","../src/services/cli-parser.service.d.mts","../src/define-environment.d.mts","../src/interfaces/commander-execution-context.interface.d.mts","../src/tokens/execution-context.token.d.mts"],"sourcesContent":["/**\n * Interface that all command classes must implement.\n *\n * Commands decorated with `@Command` must implement this interface.\n * The `execute` method is called when the command is invoked.\n *\n * @template TOptions - The type of options that the command accepts\n *\n * @example\n * ```typescript\n * import { Command, CommandHandler } from '@navios/commander'\n * import { z } from 'zod'\n *\n * const optionsSchema = z.object({\n * name: z.string()\n * })\n *\n * type Options = z.infer<typeof optionsSchema>\n *\n * @Command({ path: 'greet', optionsSchema })\n * export class GreetCommand implements CommandHandler<Options> {\n * async execute(options: Options) {\n * console.log(`Hello, ${options.name}!`)\n * }\n * }\n * ```\n */\nexport interface CommandHandler<TOptions = any> {\n /**\n * Executes the command with the provided options.\n *\n * @param options - The validated command options (validated against the command's schema if provided)\n * @returns A promise or void\n */\n execute(options: TOptions): void | Promise<void>;\n}\n//# sourceMappingURL=command-handler.interface.d.mts.map","import { z } from 'zod';\nimport type { CommandHandler } from '../interfaces/command-handler.interface.mjs';\ndeclare const helpOptionsSchema: z.ZodObject<{\n command: z.ZodOptional<z.ZodString>;\n}, z.core.$strip>;\ntype HelpOptions = z.infer<typeof helpOptionsSchema>;\n/**\n * Built-in help command that lists all available commands or shows help for a specific command.\n *\n * @public\n */\nexport declare class HelpCommand implements CommandHandler<HelpOptions> {\n private logger;\n private commandRegistry;\n execute(options: HelpOptions): Promise<void>;\n}\nexport {};\n//# sourceMappingURL=help.command.d.mts.map","import type { AbstractAdapterInterface } from '@navios/core';\n/**\n * Interface for CLI adapters.\n * Extends the base adapter interface with CLI-specific methods.\n *\n * @public\n */\nexport interface AbstractCliAdapterInterface extends AbstractAdapterInterface {\n /**\n * Run the CLI application with the given arguments.\n * Parses arguments and executes the matching command.\n *\n * @param argv - Command-line arguments array (defaults to `process.argv`)\n *\n * @example\n * ```typescript\n * const adapter = app.getAdapter() as AbstractCliAdapterInterface\n * await adapter.run(process.argv)\n * ```\n */\n run(argv?: string[]): Promise<void>;\n /**\n * Execute a command programmatically with the provided options.\n *\n * @param path - The command path (e.g., 'greet', 'user:create')\n * @param options - The command options object\n *\n * @example\n * ```typescript\n * await adapter.executeCommand('user:create', {\n * name: 'John',\n * email: 'john@example.com',\n * })\n * ```\n */\n executeCommand(path: string, options: Record<string, unknown>): Promise<void>;\n /**\n * Get all registered command paths and their class references.\n *\n * @returns Array of objects containing path and class\n *\n * @example\n * ```typescript\n * const commands = adapter.getAllCommands()\n * commands.forEach(({ path }) => console.log(path))\n * ```\n */\n getAllCommands(): Array<{\n path: string;\n class: unknown;\n }>;\n}\n//# sourceMappingURL=abstract-cli-adapter.interface.d.mts.map","import type { AdapterEnvironment } from '@navios/core';\nimport type { AbstractCliAdapterInterface } from './abstract-cli-adapter.interface.mjs';\n/**\n * Options for configuring the CLI adapter.\n *\n * @public\n */\nexport interface CliAdapterOptions {\n}\n/**\n * Environment type definition for CLI adapters.\n * Used with NaviosFactory.create<CliEnvironment>() for type-safe CLI applications.\n *\n * @public\n *\n * @example\n * ```typescript\n * import { NaviosFactory } from '@navios/core'\n * import { defineCliEnvironment, type CliEnvironment } from '@navios/commander'\n *\n * const app = await NaviosFactory.create<CliEnvironment>(AppModule, {\n * adapter: defineCliEnvironment(),\n * })\n * ```\n */\nexport interface CliEnvironment extends AdapterEnvironment {\n options: CliAdapterOptions;\n adapter: AbstractCliAdapterInterface;\n}\n//# sourceMappingURL=environment.interface.d.mts.map","import type { ClassTypeWithInstance, LogLevel, NaviosApplication, NaviosModule } from '@navios/core';\nimport type { CliEnvironment } from './interfaces/environment.interface.mjs';\n/**\n * Logger display options for CLI applications.\n * All options default to false for cleaner CLI output.\n *\n * @public\n */\nexport interface CommanderLoggerOptions {\n /**\n * Enabled log levels.\n * @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']\n */\n logLevels?: LogLevel[];\n /**\n * If true, will print the process ID in the log message.\n * @default false\n */\n showPid?: boolean;\n /**\n * If true, will print the log level in the log message.\n * @default true\n */\n showLogLevel?: boolean;\n /**\n * If true, will print the prefix/app name in the log message.\n * @default false\n */\n showPrefix?: boolean;\n /**\n * If true, will print the context in the log message.\n * @default true\n */\n showContext?: boolean;\n /**\n * If true, will print the absolute timestamp in the log message.\n * @default false\n */\n showTimestamp?: boolean;\n /**\n * If enabled, will print timestamp difference between current and previous log message.\n * @default false\n */\n showTimeDiff?: boolean;\n}\n/**\n * Configuration options for CommanderFactory.\n *\n * @public\n */\nexport interface CommanderFactoryOptions {\n /**\n * Logger display options. These override the default CLI-friendly logger settings.\n */\n logger?: CommanderLoggerOptions;\n}\n/**\n * Factory class for creating CLI applications.\n *\n * This is a convenience wrapper around `NaviosFactory.create()` that\n * configures everything needed for CLI usage. It sets up the CLI adapter\n * and returns a typed `NaviosApplication<CliEnvironment>`.\n *\n * @example\n * ```typescript\n * import { CommanderFactory } from '@navios/commander'\n * import { AppModule } from './app.module'\n *\n * async function bootstrap() {\n * const app = await CommanderFactory.create(AppModule)\n * await app.init()\n *\n * const adapter = app.getAdapter()\n * await adapter.run(process.argv)\n *\n * await app.close()\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Alternative: use NaviosFactory directly\n * import { NaviosFactory } from '@navios/core'\n * import { defineCliEnvironment, type CliEnvironment } from '@navios/commander'\n *\n * const app = await NaviosFactory.create<CliEnvironment>(AppModule, {\n * adapter: defineCliEnvironment(),\n * })\n * ```\n */\nexport declare class CommanderFactory {\n /**\n * Creates a new CLI application instance configured with the provided module.\n *\n * @param appModule - The root CLI module class decorated with `@CliModule`\n * @param options - Optional configuration options for the CLI application\n * @returns A promise that resolves to a configured NaviosApplication instance\n *\n * @example\n * ```typescript\n * const app = await CommanderFactory.create(AppModule)\n * await app.init()\n *\n * const adapter = app.getAdapter()\n * await adapter.run(process.argv)\n * ```\n */\n static create<TModule extends NaviosModule = NaviosModule>(appModule: ClassTypeWithInstance<TModule>, options?: CommanderFactoryOptions): Promise<NaviosApplication<CliEnvironment>>;\n}\n//# sourceMappingURL=commander.factory.d.mts.map","import type { ClassType, Registry } from '@navios/core';\nimport type { ZodObject } from 'zod';\n/**\n * Options for the `@Command` decorator.\n *\n * @public\n */\nexport interface CommandOptions {\n /**\n * The command path that users will invoke from the CLI.\n * Can be a single word (e.g., 'greet') or multi-word with colons (e.g., 'user:create', 'db:migrate').\n */\n path: string;\n /**\n * Optional description of the command for help text.\n * Displayed when users run `help` or `--help`.\n */\n description?: string;\n /**\n * Optional Zod schema for validating command options.\n * If provided, options will be validated and parsed according to this schema.\n */\n optionsSchema?: ZodObject;\n /**\n * Priority level for the command.\n * Higher priority commands will be loaded first.\n */\n priority?: number;\n /**\n * Registry to use for the command.\n * Registry is used to store the command and its options schema.\n */\n registry?: Registry;\n}\n/**\n * Decorator that marks a class as a CLI command.\n *\n * The decorated class must implement the `CommandHandler` interface with an `execute` method.\n * The command will be automatically registered when its module is loaded.\n *\n * @param options - Configuration options for the command\n * @returns A class decorator function\n *\n * @example\n * ```typescript\n * import { Command, CommandHandler } from '@navios/commander'\n * import { z } from 'zod'\n *\n * const optionsSchema = z.object({\n * name: z.string(),\n * greeting: z.string().optional().default('Hello')\n * })\n *\n * @Command({\n * path: 'greet',\n * optionsSchema: optionsSchema\n * })\n * export class GreetCommand implements CommandHandler<z.infer<typeof optionsSchema>> {\n * async execute(options) {\n * console.log(`${options.greeting}, ${options.name}!`)\n * }\n * }\n * ```\n */\nexport declare function Command({ path, description, optionsSchema, priority, registry, }: CommandOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;\n//# sourceMappingURL=command.decorator.d.mts.map","import type { ClassType, Registry } from '@navios/core';\n/**\n * Options for the `@CliModule` decorator.\n *\n * @public\n */\nexport interface CliModuleOptions {\n /**\n * Array or Set of command classes to register in this module.\n * Commands must be decorated with `@Command`.\n */\n commands?: ClassType[] | Set<ClassType>;\n /**\n * Array or Set of controller classes for HTTP endpoints.\n * Allows mixing HTTP and CLI functionality in the same module.\n */\n controllers?: ClassType[] | Set<ClassType>;\n /**\n * Array or Set of other modules to import.\n * Imported modules' commands and controllers will be available.\n */\n imports?: ClassType[] | Set<ClassType>;\n /**\n * Guards to apply to all controllers in this module.\n * Guards are executed in reverse order (last guard first).\n */\n guards?: ClassType[] | Set<ClassType>;\n /**\n * Service override classes to import for side effects.\n * These classes are imported to ensure their @Injectable decorators execute,\n * allowing them to register with the DI system. Overrides should use the same\n * InjectionToken as the original service with a higher priority.\n */\n overrides?: ClassType[] | Set<ClassType>;\n /**\n * Priority level for the module.\n * Higher priority modules will be loaded first.\n */\n priority?: number;\n /**\n * Registry to use for the module.\n * Registry is used to store the module and its commands.\n */\n registry?: Registry;\n}\n/**\n * Decorator that marks a class as a CLI module.\n *\n * This decorator extends the standard @Module decorator, adding support for\n * CLI commands while maintaining full compatibility with HTTP controllers.\n * Modules organize commands and can import other modules to compose larger\n * CLI applications.\n *\n * The module can optionally implement `NaviosModule` interface for lifecycle hooks.\n *\n * @param options - Configuration options for the module\n * @returns A class decorator function\n *\n * @example\n * ```typescript\n * import { CliModule } from '@navios/commander'\n * import { GreetCommand } from './greet.command'\n * import { UserModule } from './user.module'\n *\n * @CliModule({\n * commands: [GreetCommand],\n * imports: [UserModule]\n * })\n * export class AppModule {}\n * ```\n *\n * @example\n * ```typescript\n * // Mixed HTTP and CLI module\n * @CliModule({\n * controllers: [HealthController],\n * commands: [MigrateCommand],\n * imports: [DatabaseModule],\n * })\n * export class AppModule {}\n * ```\n */\nexport declare function CliModule({ commands, controllers, imports, guards, overrides, priority, registry, }?: CliModuleOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;\n//# sourceMappingURL=cli-module.decorator.d.mts.map","import type { ClassType, ModuleMetadata } from '@navios/core';\nimport type { AbstractCliAdapterInterface } from '../interfaces/abstract-cli-adapter.interface.mjs';\nimport type { CliAdapterOptions } from '../interfaces/environment.interface.mjs';\n/**\n * CLI adapter service that implements the AbstractCliAdapterInterface.\n * Handles command discovery, registration, parsing, and execution.\n *\n * @public\n */\nexport declare class CommanderAdapterService implements AbstractCliAdapterInterface {\n private container;\n private commandRegistry;\n private cliParser;\n private logger;\n private options;\n private isReady;\n /**\n * Sets up the adapter with the provided options.\n * Called during application initialization.\n */\n setupAdapter(options: CliAdapterOptions): Promise<void>;\n /**\n * Called after all modules are loaded.\n * Iterates through modules and extracts commands from customEntries.\n */\n onModulesInit(modules: Map<string, ModuleMetadata>): Promise<void>;\n /**\n * Registers built-in commands like help.\n */\n private registerBuiltInCommands;\n /**\n * Signals that the adapter is ready to handle commands.\n */\n ready(): Promise<void>;\n /**\n * Disposes of the adapter and cleans up resources.\n */\n dispose(): Promise<void>;\n /**\n * Run the CLI application with the given arguments.\n * Parses arguments and executes the matching command.\n */\n run(argv?: string[]): Promise<void>;\n /**\n * Execute a command programmatically with the provided options.\n */\n executeCommand(path: string, options?: Record<string, unknown>): Promise<void>;\n /**\n * Get all registered command paths and their class references.\n */\n getAllCommands(): Array<{\n path: string;\n class: ClassType;\n }>;\n}\n//# sourceMappingURL=commander-adapter.service.d.mts.map","import type { ClassType } from '@navios/core';\nimport type { ZodObject } from 'zod';\n/**\n * @internal\n * Symbol key used to store command metadata on classes.\n */\nexport declare const CommandMetadataKey: unique symbol;\n/**\n * Metadata associated with a command.\n *\n * @public\n */\nexport interface CommandMetadata {\n /**\n * The command path (e.g., 'greet', 'user:create').\n */\n path: string;\n /**\n * Optional description of the command for help text.\n */\n description?: string;\n /**\n * Optional Zod schema for validating command options.\n */\n optionsSchema?: ZodObject;\n /**\n * Map of custom attributes that can be attached to the command.\n */\n customAttributes: Map<string | symbol, any>;\n}\n/**\n * Gets or creates command metadata for a class.\n *\n * @internal\n * @param target - The command class\n * @param context - The decorator context\n * @param path - The command path\n * @param description - Optional description for help text\n * @param optionsSchema - Optional Zod schema\n * @returns The command metadata\n */\nexport declare function getCommandMetadata(target: ClassType, context: ClassDecoratorContext, path: string, description?: string, optionsSchema?: ZodObject): CommandMetadata;\n/**\n * Extracts command metadata from a class.\n *\n * @param target - The command class\n * @returns The command metadata\n * @throws {Error} If the class is not decorated with @Command\n *\n * @example\n * ```typescript\n * const metadata = extractCommandMetadata(GreetCommand)\n * console.log(metadata.path) // 'greet'\n * ```\n */\nexport declare function extractCommandMetadata(target: ClassType): CommandMetadata;\n/**\n * Checks if a class has command metadata.\n *\n * @param target - The class to check\n * @returns `true` if the class is decorated with @Command, `false` otherwise\n */\nexport declare function hasCommandMetadata(target: ClassType): boolean;\n//# sourceMappingURL=command.metadata.d.mts.map","import type { ClassType } from '@navios/core';\n/**\n * Symbol key for storing commands in ModuleMetadata.customEntries.\n * Used by @CliModule to store command classes.\n *\n * @public\n */\nexport declare const CommandEntryKey: unique symbol;\n/**\n * Type for the command entry value stored in customEntries.\n *\n * @public\n */\nexport type CommandEntryValue = Set<ClassType>;\n/**\n * Extracts commands from a module's metadata.\n * Returns empty set if no commands are defined.\n *\n * @param moduleClass - The module class decorated with @CliModule or @Module\n * @returns Set of command classes registered in the module\n *\n * @example\n * ```typescript\n * const commands = extractModuleCommands(AppModule)\n * for (const command of commands) {\n * console.log(command.name)\n * }\n * ```\n */\nexport declare function extractModuleCommands(moduleClass: ClassType): Set<ClassType>;\n//# sourceMappingURL=command-entry.metadata.d.mts.map","import type { ClassType } from '@navios/core';\nimport type { CommandMetadata } from '../metadata/index.mjs';\n/**\n * Represents a registered command with its metadata and module information.\n *\n * @public\n */\nexport interface RegisteredCommand {\n /**\n * The command class\n */\n class: ClassType;\n /**\n * The command metadata from @Command decorator\n */\n metadata: CommandMetadata;\n /**\n * Name of the module this command belongs to\n */\n moduleName: string;\n}\n/**\n * Service for registering and looking up CLI commands.\n * Used internally by the CLI adapter to manage discovered commands.\n *\n * @public\n */\nexport declare class CommandRegistryService {\n private commands;\n /**\n * Register a command with its metadata.\n *\n * @param path - The command path (e.g., 'greet', 'user:create')\n * @param command - The registered command data\n * @throws Error if a command with the same path is already registered\n */\n register(path: string, command: RegisteredCommand): void;\n /**\n * Get a command by its path.\n *\n * @param path - The command path\n * @returns The registered command or undefined if not found\n */\n getByPath(path: string): RegisteredCommand | undefined;\n /**\n * Get all registered commands.\n *\n * @returns Map of path to registered command\n */\n getAll(): Map<string, RegisteredCommand>;\n /**\n * Get all registered commands as an array of path and class pairs.\n * Useful for listing available commands.\n *\n * @returns Array of objects containing path and class\n */\n getAllAsArray(): Array<{\n path: string;\n class: ClassType;\n }>;\n /**\n * Formats help text listing all available commands with descriptions.\n *\n * @returns Formatted string listing all commands\n */\n formatCommandList(): string;\n /**\n * Formats help text for a specific command.\n *\n * @param commandPath - The command path to show help for\n * @returns Formatted string with command help\n */\n formatCommandHelp(commandPath: string): string;\n /**\n * Gets a human-readable type name from a Zod schema.\n */\n private getSchemaTypeName;\n /**\n * Gets metadata from a Zod schema, traversing innerType if needed.\n * Zod v4 stores meta at the outermost layer when .meta() is called last,\n * or in innerType when .meta() is called before .optional()/.default().\n */\n private getSchemaMeta;\n /**\n * Clear all registered commands.\n */\n clear(): void;\n}\n//# sourceMappingURL=command-registry.service.d.mts.map","import type { ZodObject } from 'zod';\n/**\n * Result of parsing command-line arguments.\n *\n * @public\n */\nexport interface ParsedCliArgs {\n /**\n * The command path (e.g., 'greet', 'user:create').\n * Multi-word commands are joined with spaces.\n */\n command: string;\n /**\n * Parsed options as key-value pairs.\n * Keys are converted from kebab-case to camelCase.\n */\n options: Record<string, any>;\n /**\n * Positional arguments that don't match any option flags.\n */\n positionals: string[];\n}\n/**\n * Service for parsing command-line arguments.\n *\n * Handles parsing of various CLI argument formats including:\n * - Long options: `--key value` or `--key=value`\n * - Short options: `-k value` or `-abc` (multiple flags)\n * - Boolean flags\n * - Array options\n * - Positional arguments\n *\n * @public\n */\nexport declare class CliParserService {\n /**\n * Parses command-line arguments from process.argv\n * Commands can be multi-word (e.g., 'db migrate', 'cache clear')\n * Expected format: node script.js command [subcommand...] --flag value --boolean-flag positional1 positional2\n *\n * @param argv - Array of command-line arguments (typically process.argv)\n * @param optionsSchema - Optional Zod schema to determine boolean flags and option types\n * @returns Parsed command (space-separated if multi-word), options, and positional arguments\n */\n parse(argv: string[], optionsSchema?: ZodObject): ParsedCliArgs;\n /**\n * Converts kebab-case to camelCase\n */\n private camelCase;\n /**\n * Attempts to parse string values into appropriate types\n */\n private parseValue;\n /**\n * Extracts boolean field names from a Zod schema\n * Handles ZodObject, ZodOptional, and ZodDefault wrappers\n */\n private extractBooleanFields;\n /**\n * Extracts array field names from a Zod schema\n * Handles ZodObject, ZodOptional, and ZodDefault wrappers\n */\n private extractArrayFields;\n /**\n * Checks if a Zod schema represents a boolean type\n * Unwraps ZodOptional and ZodDefault using Zod v4 API\n */\n private isSchemaBoolean;\n /**\n * Checks if a Zod schema represents an array type\n * Unwraps ZodOptional and ZodDefault using Zod v4 API\n */\n private isSchemaArray;\n}\n//# sourceMappingURL=cli-parser.service.d.mts.map","import type { AnyInjectableType, InjectionToken } from '@navios/core';\nimport { CommanderAdapterService } from './services/commander-adapter.service.mjs';\nimport { CommandRegistryService } from './services/command-registry.service.mjs';\nimport { CliParserService } from './services/cli-parser.service.mjs';\n/**\n * Defines the CLI environment configuration for use with NaviosFactory.\n *\n * This function returns the token mappings needed to configure a CLI application.\n * Use it with `NaviosFactory.create()` to create a CLI application.\n *\n * @returns Environment configuration with token mappings\n *\n * @example\n * ```typescript\n * import { NaviosFactory } from '@navios/core'\n * import { defineCliEnvironment, type CliEnvironment } from '@navios/commander'\n *\n * const app = await NaviosFactory.create<CliEnvironment>(AppModule, {\n * adapter: defineCliEnvironment(),\n * })\n * await app.init()\n *\n * const adapter = app.getAdapter() as AbstractCliAdapterInterface\n * await adapter.run(process.argv)\n * ```\n */\nexport declare function defineCliEnvironment(): {\n tokens: Map<InjectionToken<any, undefined, false>, AnyInjectableType>;\n};\nexport { CommanderAdapterService, CommandRegistryService, CliParserService };\n//# sourceMappingURL=define-environment.d.mts.map","import type { CommandMetadata } from '../metadata/command.metadata.mjs';\n/**\n * Execution context for a command execution.\n *\n * Provides access to command metadata, path, and validated options during command execution.\n * This context is automatically injected and available via the `CommandExecutionContext` token.\n *\n * @example\n * ```typescript\n * import { inject, Injectable } from '@navios/core'\n * import { CommandExecutionContext } from '@navios/commander'\n *\n * @Injectable()\n * class CommandLogger {\n * private ctx = inject(CommandExecutionContext)\n *\n * log() {\n * console.log('Command:', this.ctx.getCommandPath())\n * console.log('Options:', this.ctx.getOptions())\n * }\n * }\n * ```\n */\nexport declare class CommanderExecutionContext {\n private readonly command;\n private readonly commandPath;\n private readonly options;\n /**\n * @internal\n * Creates a new execution context.\n */\n constructor(command: CommandMetadata, commandPath: string, options: any);\n /**\n * Gets the command metadata.\n *\n * @returns The command metadata including path and options schema\n */\n getCommand(): CommandMetadata;\n /**\n * Gets the command path that was invoked.\n *\n * @returns The command path (e.g., 'greet', 'user:create')\n */\n getCommandPath(): string;\n /**\n * Gets the validated command options.\n *\n * Options are validated against the command's Zod schema if one was provided.\n *\n * @returns The validated options object\n */\n getOptions(): any;\n}\n//# sourceMappingURL=commander-execution-context.interface.d.mts.map","import { InjectionToken } from '@navios/core';\nimport type { CommanderExecutionContext } from '../interfaces/index.mjs';\n/**\n * Injection token for accessing the current command execution context.\n *\n * Use this token with `inject()` to access the `CommanderExecutionContext` in services\n * that need information about the currently executing command.\n *\n * @example\n * ```typescript\n * import { inject, Injectable } from '@navios/core'\n * import { CommandExecutionContext } from '@navios/commander'\n *\n * @Injectable()\n * class MyService {\n * private ctx = inject(CommandExecutionContext)\n *\n * doSomething() {\n * const commandPath = this.ctx.getCommandPath()\n * const options = this.ctx.getOptions()\n * // Use context information...\n * }\n * }\n * ```\n */\nexport declare const CommandExecutionContext: InjectionToken<CommanderExecutionContext, undefined, false>;\n//# sourceMappingURL=execution-context.token.d.mts.map"],"mappings":";;;;;;;;;;;;AA2BA;;;;AC1BkF;;;;;;AACtC;AAS5C;;;;;;;;;ACJA;AAa0BiB,UFOTjB,cEPSiB,CAAAA,WAAAA,GAAAA,CAAAA,CAAAA;EAegBC;;;;;;mBFDrBjB,kBAAkBC;;;;cChCzBG,mBAAmBF,CAAAA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;AAS5C;;;;;;;;;ACJiBlB,iBUmBOgF,oBAAAA,CAAAA,CVnBoB,EAAA;EAalB/E,MAAAA,EUOdgF,GVPchF,CUOV2E,cVPU3E,CAAAA,GAAAA,EAAAA,SAAAA,EAAAA,KAAAA,CAAAA,EUO6B0E,iBVP7B1E,CAAAA;CAegBC;;;;;;;;AFR1C;;;;AC1BkF;;;;;;AACtC;AAS5C;;;;;;cYYqBiF,yBAAAA;;;EXhBJnF,iBAAAA,OAAAA;EAaSC;;;;EAb2BF,WAAAA,CAAAA,OAAAA,EWwB5BmF,eXxB4BnF,EAAAA,WAAAA,EAAAA,MAAAA,EAAAA,OAAAA,EAAAA,GAAAA;EAAwB;;;;ACA7E;EAkBiBQ,UAAAA,CAAAA,CAAAA,EUYC2E,eVZa;EAClB5E;;;;;;;AClBb;AA0CA;AAwCA;;;;EAiB0EE,UAAAA,CAAAA,CAAAA,EAAAA,GAAAA;;;;;;;;AJhF1E;;;;AC1BkF;;;;;;AACtC;AAS5C;;;;;;;;cacqB8E,yBAAyBF,eAAeC"}
1
+ {"version":3,"file":"index.d.mts","names":["z","CommandHandler","helpOptionsSchema","ZodString","ZodOptional","core","$strip","ZodObject","HelpOptions","infer","HelpCommand","Promise","ClassTypeWithInstance","LogLevel","NaviosApplication","NaviosModule","CliEnvironment","CommanderLoggerOptions","CommanderTuiOptions","Record","CommanderFactoryOptions","CommanderFactory","TModule","Promise","ClassType","ModuleMetadata","AbstractCliAdapterInterface","CliAdapterOptions","CommanderAdapterService","Promise","Map","Record","Array","ClassType","CommandEntryKey","CommandEntryValue","Set","extractModuleCommands","ClassType","CommandMetadata","RegisteredCommand","CommandRegistryService","Map","Array","ZodObject","ParsedCliArgs","Record","CliParserService","AnyInjectableType","InjectionToken","CommanderAdapterService","CommandRegistryService","CliParserService","defineCliEnvironment","Map","InjectionToken","CommanderExecutionContext","CommandExecutionContext"],"sources":["../src/commands/help.command.d.mts","../src/commander.factory.d.mts","../src/services/commander-adapter.service.d.mts","../src/metadata/command-entry.metadata.d.mts","../src/services/command-registry.service.d.mts","../src/services/cli-parser.service.d.mts","../src/define-environment.d.mts","../src/tokens/execution-context.token.d.mts"],"sourcesContent":["import { z } from 'zod';\nimport type { CommandHandler } from '../interfaces/command-handler.interface.mjs';\ndeclare const helpOptionsSchema: z.ZodObject<{\n command: z.ZodOptional<z.ZodString>;\n}, z.core.$strip>;\ntype HelpOptions = z.infer<typeof helpOptionsSchema>;\n/**\n * Built-in help command that lists all available commands or shows help for a specific command.\n *\n * @public\n */\nexport declare class HelpCommand implements CommandHandler<HelpOptions> {\n private logger;\n private commandRegistry;\n execute(options: HelpOptions): Promise<void>;\n}\nexport {};\n//# sourceMappingURL=help.command.d.mts.map","import type { ClassTypeWithInstance, LogLevel, NaviosApplication, NaviosModule } from '@navios/core';\nimport type { CliEnvironment } from './interfaces/environment.interface.mjs';\n/**\n * Logger display options for CLI applications.\n * All options default to false for cleaner CLI output.\n *\n * @public\n */\nexport interface CommanderLoggerOptions {\n /**\n * Enabled log levels.\n * @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']\n */\n logLevels?: LogLevel[];\n /**\n * If true, will print the process ID in the log message.\n * @default false\n */\n showPid?: boolean;\n /**\n * If true, will print the log level in the log message.\n * @default true\n */\n showLogLevel?: boolean;\n /**\n * If true, will print the prefix/app name in the log message.\n * @default false\n */\n showPrefix?: boolean;\n /**\n * If true, will print the context in the log message.\n * @default true\n */\n showContext?: boolean;\n /**\n * If true, will print the absolute timestamp in the log message.\n * @default false\n */\n showTimestamp?: boolean;\n /**\n * If enabled, will print timestamp difference between current and previous log message.\n * @default false\n */\n showTimeDiff?: boolean;\n}\n/**\n * TUI-specific options for terminal UI mode.\n * Only used when enableTUI is true.\n *\n * @public\n */\nexport interface CommanderTuiOptions {\n /**\n * Exit on Ctrl+C.\n * @default true\n */\n exitOnCtrlC?: boolean;\n /**\n * Sidebar width in columns.\n */\n sidebarWidth?: number;\n /**\n * Sidebar position.\n */\n sidebarPosition?: 'left' | 'right';\n /**\n * Sidebar header title.\n */\n sidebarTitle?: string;\n /**\n * Auto close after all screens complete successfully.\n * Set to true for default delay (5000ms), or specify delay in milliseconds.\n */\n autoClose?: boolean | number;\n /**\n * Theme preset name ('dark', 'light', 'high-contrast') or custom theme object.\n */\n theme?: string | Record<string, unknown>;\n /**\n * Enable mouse support.\n * @default false\n */\n useMouse?: boolean;\n /**\n * Hide the default console logger screen from the sidebar.\n * @default false\n */\n hideDefaultScreen?: boolean;\n}\n/**\n * Configuration options for CommanderFactory.\n *\n * @public\n */\nexport interface CommanderFactoryOptions {\n /**\n * Enabled log levels.\n * @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']\n */\n logLevels?: LogLevel[];\n /**\n * Logger display options. These override the default CLI-friendly logger settings.\n * Ignored when enableTUI is true.\n */\n logger?: CommanderLoggerOptions;\n /**\n * Enable TUI mode with @navios/commander-tui.\n * Requires @navios/commander-tui to be installed.\n */\n enableTUI?: boolean;\n /**\n * TUI-specific options. Only used when enableTUI is true.\n */\n tuiOptions?: CommanderTuiOptions;\n}\n/**\n * Factory class for creating CLI applications.\n *\n * This is a convenience wrapper around `NaviosFactory.create()` that\n * configures everything needed for CLI usage. It sets up the CLI adapter\n * and returns a typed `NaviosApplication<CliEnvironment>`.\n *\n * @example\n * ```typescript\n * import { CommanderFactory } from '@navios/commander'\n * import { AppModule } from './app.module'\n *\n * async function bootstrap() {\n * const app = await CommanderFactory.create(AppModule)\n * await app.init()\n *\n * const adapter = app.getAdapter()\n * await adapter.run(process.argv)\n *\n * await app.close()\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Alternative: use NaviosFactory directly\n * import { NaviosFactory } from '@navios/core'\n * import { defineCliEnvironment, type CliEnvironment } from '@navios/commander'\n *\n * const app = await NaviosFactory.create<CliEnvironment>(AppModule, {\n * adapter: defineCliEnvironment(),\n * })\n * ```\n */\nexport declare class CommanderFactory {\n /**\n * Creates a new CLI application instance configured with the provided module.\n *\n * @param appModule - The root CLI module class decorated with `@CliModule`\n * @param options - Optional configuration options for the CLI application\n * @returns A promise that resolves to a configured NaviosApplication instance\n *\n * @example\n * ```typescript\n * const app = await CommanderFactory.create(AppModule)\n * await app.init()\n *\n * const adapter = app.getAdapter()\n * await adapter.run(process.argv)\n * ```\n */\n static create<TModule extends NaviosModule = NaviosModule>(appModule: ClassTypeWithInstance<TModule>, options?: CommanderFactoryOptions): Promise<NaviosApplication<CliEnvironment>>;\n}\n//# sourceMappingURL=commander.factory.d.mts.map","import type { ClassType, ModuleMetadata } from '@navios/core';\nimport type { AbstractCliAdapterInterface } from '../interfaces/abstract-cli-adapter.interface.mjs';\nimport type { CliAdapterOptions } from '../interfaces/environment.interface.mjs';\n/**\n * CLI adapter service that implements the AbstractCliAdapterInterface.\n * Handles command discovery, registration, parsing, and execution.\n *\n * @public\n */\nexport declare class CommanderAdapterService implements AbstractCliAdapterInterface {\n private container;\n private commandRegistry;\n private cliParser;\n private logger;\n private options;\n private isReady;\n /**\n * Sets up the adapter with the provided options.\n * Called during application initialization.\n */\n setupAdapter(options: CliAdapterOptions): Promise<void>;\n /**\n * Called after all modules are loaded.\n * Iterates through modules and extracts commands from customEntries.\n */\n onModulesInit(modules: Map<string, ModuleMetadata>): Promise<void>;\n /**\n * Registers built-in commands like help.\n */\n private registerBuiltInCommands;\n /**\n * Signals that the adapter is ready to handle commands.\n */\n ready(): Promise<void>;\n /**\n * Disposes of the adapter and cleans up resources.\n */\n dispose(): Promise<void>;\n /**\n * Run the CLI application with the given arguments.\n * Parses arguments and executes the matching command.\n */\n run(argv?: string[]): Promise<void>;\n /**\n * Execute a command programmatically with the provided options.\n */\n executeCommand(path: string, options?: Record<string, unknown>): Promise<void>;\n /**\n * Get all registered command paths and their class references.\n */\n getAllCommands(): Array<{\n path: string;\n class: ClassType;\n }>;\n}\n//# sourceMappingURL=commander-adapter.service.d.mts.map","import type { ClassType } from '@navios/core';\n/**\n * Symbol key for storing commands in ModuleMetadata.customEntries.\n * Used by @CliModule to store command classes.\n *\n * @public\n */\nexport declare const CommandEntryKey: unique symbol;\n/**\n * Type for the command entry value stored in customEntries.\n *\n * @public\n */\nexport type CommandEntryValue = Set<ClassType>;\n/**\n * Extracts commands from a module's metadata.\n * Returns empty set if no commands are defined.\n *\n * @param moduleClass - The module class decorated with @CliModule or @Module\n * @returns Set of command classes registered in the module\n *\n * @example\n * ```typescript\n * const commands = extractModuleCommands(AppModule)\n * for (const command of commands) {\n * console.log(command.name)\n * }\n * ```\n */\nexport declare function extractModuleCommands(moduleClass: ClassType): Set<ClassType>;\n//# sourceMappingURL=command-entry.metadata.d.mts.map","import type { ClassType } from '@navios/core';\nimport type { CommandMetadata } from '../metadata/index.mjs';\n/**\n * Represents a registered command with its metadata and module information.\n *\n * @public\n */\nexport interface RegisteredCommand {\n /**\n * The command class\n */\n class: ClassType;\n /**\n * The command metadata from @Command decorator\n */\n metadata: CommandMetadata;\n /**\n * Name of the module this command belongs to\n */\n moduleName: string;\n}\n/**\n * Service for registering and looking up CLI commands.\n * Used internally by the CLI adapter to manage discovered commands.\n *\n * @public\n */\nexport declare class CommandRegistryService {\n private commands;\n /**\n * Register a command with its metadata.\n *\n * @param path - The command path (e.g., 'greet', 'user:create')\n * @param command - The registered command data\n * @throws Error if a command with the same path is already registered\n */\n register(path: string, command: RegisteredCommand): void;\n /**\n * Get a command by its path.\n *\n * @param path - The command path\n * @returns The registered command or undefined if not found\n */\n getByPath(path: string): RegisteredCommand | undefined;\n /**\n * Get all registered commands.\n *\n * @returns Map of path to registered command\n */\n getAll(): Map<string, RegisteredCommand>;\n /**\n * Get all registered commands as an array of path and class pairs.\n * Useful for listing available commands.\n *\n * @returns Array of objects containing path and class\n */\n getAllAsArray(): Array<{\n path: string;\n class: ClassType;\n }>;\n /**\n * Formats help text listing all available commands with descriptions.\n *\n * @returns Formatted string listing all commands\n */\n formatCommandList(): string;\n /**\n * Formats help text for a specific command.\n *\n * @param commandPath - The command path to show help for\n * @returns Formatted string with command help\n */\n formatCommandHelp(commandPath: string): string;\n /**\n * Gets a human-readable type name from a Zod schema.\n */\n private getSchemaTypeName;\n /**\n * Gets metadata from a Zod schema, traversing innerType if needed.\n * Zod v4 stores meta at the outermost layer when .meta() is called last,\n * or in innerType when .meta() is called before .optional()/.default().\n */\n private getSchemaMeta;\n /**\n * Clear all registered commands.\n */\n clear(): void;\n}\n//# sourceMappingURL=command-registry.service.d.mts.map","import type { ZodObject } from 'zod';\n/**\n * Result of parsing command-line arguments.\n *\n * @public\n */\nexport interface ParsedCliArgs {\n /**\n * The command path (e.g., 'greet', 'user:create').\n * Multi-word commands are joined with spaces.\n */\n command: string;\n /**\n * Parsed options as key-value pairs.\n * Keys are converted from kebab-case to camelCase.\n */\n options: Record<string, any>;\n /**\n * Positional arguments that don't match any option flags.\n */\n positionals: string[];\n}\n/**\n * Service for parsing command-line arguments.\n *\n * Handles parsing of various CLI argument formats including:\n * - Long options: `--key value` or `--key=value`\n * - Short options: `-k value` or `-abc` (multiple flags)\n * - Boolean flags\n * - Array options\n * - Positional arguments\n *\n * @public\n */\nexport declare class CliParserService {\n /**\n * Parses command-line arguments from process.argv\n * Commands can be multi-word (e.g., 'db migrate', 'cache clear')\n * Expected format: node script.js command [subcommand...] --flag value --boolean-flag positional1 positional2\n *\n * @param argv - Array of command-line arguments (typically process.argv)\n * @param optionsSchema - Optional Zod schema to determine boolean flags and option types\n * @returns Parsed command (space-separated if multi-word), options, and positional arguments\n */\n parse(argv: string[], optionsSchema?: ZodObject): ParsedCliArgs;\n /**\n * Converts kebab-case to camelCase\n */\n private camelCase;\n /**\n * Attempts to parse string values into appropriate types\n */\n private parseValue;\n /**\n * Extracts boolean field names from a Zod schema\n * Handles ZodObject, ZodOptional, and ZodDefault wrappers\n */\n private extractBooleanFields;\n /**\n * Extracts array field names from a Zod schema\n * Handles ZodObject, ZodOptional, and ZodDefault wrappers\n */\n private extractArrayFields;\n /**\n * Checks if a Zod schema represents a boolean type\n * Unwraps ZodOptional and ZodDefault using Zod v4 API\n */\n private isSchemaBoolean;\n /**\n * Checks if a Zod schema represents an array type\n * Unwraps ZodOptional and ZodDefault using Zod v4 API\n */\n private isSchemaArray;\n}\n//# sourceMappingURL=cli-parser.service.d.mts.map","import type { AnyInjectableType, InjectionToken } from '@navios/core';\nimport { CommanderAdapterService } from './services/commander-adapter.service.mjs';\nimport { CommandRegistryService } from './services/command-registry.service.mjs';\nimport { CliParserService } from './services/cli-parser.service.mjs';\n/**\n * Defines the CLI environment configuration for use with NaviosFactory.\n *\n * This function returns the token mappings needed to configure a CLI application.\n * Use it with `NaviosFactory.create()` to create a CLI application.\n *\n * @returns Environment configuration with token mappings\n *\n * @example\n * ```typescript\n * import { NaviosFactory } from '@navios/core'\n * import { defineCliEnvironment, type CliEnvironment } from '@navios/commander'\n *\n * const app = await NaviosFactory.create<CliEnvironment>(AppModule, {\n * adapter: defineCliEnvironment(),\n * })\n * await app.init()\n *\n * const adapter = app.getAdapter() as AbstractCliAdapterInterface\n * await adapter.run(process.argv)\n * ```\n */\nexport declare function defineCliEnvironment(): {\n tokens: Map<InjectionToken<any, undefined, false>, AnyInjectableType>;\n};\nexport { CommanderAdapterService, CommandRegistryService, CliParserService };\n//# sourceMappingURL=define-environment.d.mts.map","import { InjectionToken } from '@navios/core';\nimport type { CommanderExecutionContext } from '../interfaces/index.mjs';\n/**\n * Injection token for accessing the current command execution context.\n *\n * Use this token with `inject()` to access the `CommanderExecutionContext` in services\n * that need information about the currently executing command.\n *\n * @example\n * ```typescript\n * import { inject, Injectable } from '@navios/core'\n * import { CommandExecutionContext } from '@navios/commander'\n *\n * @Injectable()\n * class MyService {\n * private ctx = inject(CommandExecutionContext)\n *\n * doSomething() {\n * const commandPath = this.ctx.getCommandPath()\n * const options = this.ctx.getOptions()\n * // Use context information...\n * }\n * }\n * ```\n */\nexport declare const CommandExecutionContext: InjectionToken<CommanderExecutionContext, undefined, false>;\n//# sourceMappingURL=execution-context.token.d.mts.map"],"mappings":";;;;;;cAEcE,mBAAmBF,C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