@navios/commander 1.5.0 → 1.5.1

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 (119) hide show
  1. package/.turbo/turbo-build.log +49 -0
  2. package/.turbo/turbo-check.log +2 -0
  3. package/.turbo/turbo-lint.log +3 -0
  4. package/.turbo/turbo-test$colon$ci.log +117 -0
  5. package/CHANGELOG.md +3 -3
  6. package/README.md +8 -16
  7. package/dist/src/commander.factory.d.mts +126 -122
  8. package/dist/src/commander.factory.d.mts.map +1 -1
  9. package/dist/src/commands/help.command.d.mts +15 -11
  10. package/dist/src/commands/help.command.d.mts.map +1 -1
  11. package/dist/src/commands/index.d.mts +2 -2
  12. package/dist/src/decorators/cli-module.decorator.d.mts +51 -40
  13. package/dist/src/decorators/cli-module.decorator.d.mts.map +1 -1
  14. package/dist/src/decorators/command.decorator.d.mts +49 -37
  15. package/dist/src/decorators/command.decorator.d.mts.map +1 -1
  16. package/dist/src/decorators/index.d.mts +3 -3
  17. package/dist/src/define-environment.d.mts +9 -8
  18. package/dist/src/define-environment.d.mts.map +1 -1
  19. package/dist/src/index.d.mts +10 -10
  20. package/dist/src/interfaces/abstract-cli-adapter.interface.d.mts +45 -45
  21. package/dist/src/interfaces/command-handler.interface.d.mts +9 -9
  22. package/dist/src/interfaces/commander-execution-context.interface.d.mts +30 -30
  23. package/dist/src/interfaces/commander-execution-context.interface.d.mts.map +1 -1
  24. package/dist/src/interfaces/environment.interface.d.mts +7 -7
  25. package/dist/src/interfaces/index.d.mts +5 -5
  26. package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts +6 -5
  27. package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts.map +1 -1
  28. package/dist/src/legacy-compat/decorators/command.decorator.d.mts +7 -6
  29. package/dist/src/legacy-compat/decorators/command.decorator.d.mts.map +1 -1
  30. package/dist/src/legacy-compat/decorators/index.d.mts +3 -3
  31. package/dist/src/legacy-compat/index.d.mts +3 -3
  32. package/dist/src/metadata/command-entry.metadata.d.mts +5 -5
  33. package/dist/src/metadata/command-entry.metadata.d.mts.map +1 -1
  34. package/dist/src/metadata/command.metadata.d.mts +30 -24
  35. package/dist/src/metadata/command.metadata.d.mts.map +1 -1
  36. package/dist/src/metadata/index.d.mts +3 -3
  37. package/dist/src/overrides/help.command.d.mts +15 -11
  38. package/dist/src/overrides/help.command.d.mts.map +1 -1
  39. package/dist/src/services/cli-parser.service.d.mts +54 -54
  40. package/dist/src/services/cli-parser.service.d.mts.map +1 -1
  41. package/dist/src/services/command-registry.service.d.mts +75 -74
  42. package/dist/src/services/command-registry.service.d.mts.map +1 -1
  43. package/dist/src/services/commander-adapter.service.d.mts +49 -48
  44. package/dist/src/services/commander-adapter.service.d.mts.map +1 -1
  45. package/dist/src/services/index.d.mts +4 -4
  46. package/dist/src/tokens/execution-context.token.d.mts +9 -4
  47. package/dist/src/tokens/execution-context.token.d.mts.map +1 -1
  48. package/dist/src/tokens/help-command.token.d.mts +5 -4
  49. package/dist/src/tokens/index.d.mts +2 -2
  50. package/dist/src/utils/index.d.mts +2 -2
  51. package/dist/src/utils/runtime.d.mts +2 -2
  52. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  53. package/dist/tsconfig.tsbuildinfo +1 -1
  54. package/dist/tsdown.config.d.mts +3 -3
  55. package/dist/vitest.config.d.mts +3 -3
  56. package/lib/{cli-module.decorator-CRaNGvgl.d.cts → cli-module.decorator-BzsOEMPH.d.cts} +54 -53
  57. package/lib/cli-module.decorator-BzsOEMPH.d.cts.map +1 -0
  58. package/lib/{cli-module.decorator-bsP5gEn7.d.mts → cli-module.decorator-CCV_elPP.d.mts} +116 -115
  59. package/lib/cli-module.decorator-CCV_elPP.d.mts.map +1 -0
  60. package/lib/{cli-module.decorator-CkP22084.cjs → cli-module.decorator-CXt38aqF.cjs} +2 -2
  61. package/lib/cli-module.decorator-CXt38aqF.cjs.map +1 -0
  62. package/lib/{cli-module.decorator-UGbtkRYc.mjs → cli-module.decorator-DAjf_r_W.mjs} +2 -2
  63. package/lib/cli-module.decorator-DAjf_r_W.mjs.map +1 -0
  64. package/lib/{command.decorator-UrNJmQN0.cjs → command.decorator-HziankUv.cjs} +3 -3
  65. package/lib/command.decorator-HziankUv.cjs.map +1 -0
  66. package/lib/{command.decorator-DVLSAqYZ.mjs → command.decorator-QiRU7ny3.mjs} +3 -3
  67. package/lib/command.decorator-QiRU7ny3.mjs.map +1 -0
  68. package/lib/{help-command.token-CMWYI6em.cjs → help-command.token-DamE31Aw.cjs} +4 -4
  69. package/lib/{help-command.token-CMWYI6em.cjs.map → help-command.token-DamE31Aw.cjs.map} +1 -1
  70. package/lib/{help-command.token-C0Kgj60o.mjs → help-command.token-XHx3WkoD.mjs} +4 -4
  71. package/lib/{help-command.token-C0Kgj60o.mjs.map → help-command.token-XHx3WkoD.mjs.map} +1 -1
  72. package/lib/{help.command-dtZbhq0w.mjs → help.command-Bynoll_7.mjs} +5 -8
  73. package/lib/help.command-Bynoll_7.mjs.map +1 -0
  74. package/lib/{help.command-DQyv6ali.cjs → help.command-DvKmMpB7.cjs} +6 -9
  75. package/lib/help.command-DvKmMpB7.cjs.map +1 -0
  76. package/lib/index.cjs +102 -102
  77. package/lib/index.cjs.map +1 -1
  78. package/lib/index.d.cts +283 -283
  79. package/lib/index.d.cts.map +1 -1
  80. package/lib/index.d.mts +221 -221
  81. package/lib/index.d.mts.map +1 -1
  82. package/lib/index.mjs +101 -101
  83. package/lib/index.mjs.map +1 -1
  84. package/lib/legacy-compat/index.cjs +6 -28
  85. package/lib/legacy-compat/index.cjs.map +1 -1
  86. package/lib/legacy-compat/index.d.cts +3 -2
  87. package/lib/legacy-compat/index.d.cts.map +1 -1
  88. package/lib/legacy-compat/index.d.mts +3 -2
  89. package/lib/legacy-compat/index.d.mts.map +1 -1
  90. package/lib/legacy-compat/index.mjs +4 -25
  91. package/lib/legacy-compat/index.mjs.map +1 -1
  92. package/package.json +26 -16
  93. package/src/__tests__/commander.factory.e2e.spec.mts +22 -66
  94. package/src/commands/help.command.mts +1 -1
  95. package/src/decorators/cli-module.decorator.mts +4 -9
  96. package/src/decorators/command.decorator.mts +4 -4
  97. package/src/define-environment.mts +4 -4
  98. package/src/interfaces/command-handler.interface.mts +1 -1
  99. package/src/interfaces/commander-execution-context.interface.mts +1 -1
  100. package/src/legacy-compat/decorators/cli-module.decorator.mts +2 -1
  101. package/src/legacy-compat/decorators/command.decorator.mts +3 -2
  102. package/src/metadata/command-entry.metadata.mts +3 -6
  103. package/src/metadata/command.metadata.mts +6 -8
  104. package/src/overrides/help.command.mts +2 -2
  105. package/src/services/__tests__/cli-parser.service.spec.mts +23 -178
  106. package/src/services/cli-parser.service.mts +23 -27
  107. package/src/services/command-registry.service.mts +5 -5
  108. package/src/services/commander-adapter.service.mts +10 -27
  109. package/src/tokens/execution-context.token.mts +4 -6
  110. package/tsconfig.json +3 -0
  111. package/lib/cli-module.decorator-CRaNGvgl.d.cts.map +0 -1
  112. package/lib/cli-module.decorator-CkP22084.cjs.map +0 -1
  113. package/lib/cli-module.decorator-UGbtkRYc.mjs.map +0 -1
  114. package/lib/cli-module.decorator-bsP5gEn7.d.mts.map +0 -1
  115. package/lib/command.decorator-DVLSAqYZ.mjs.map +0 -1
  116. package/lib/command.decorator-UrNJmQN0.cjs.map +0 -1
  117. package/lib/help.command-DQyv6ali.cjs.map +0 -1
  118. package/lib/help.command-dtZbhq0w.mjs.map +0 -1
  119. package/project.json +0 -66
package/lib/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as CommandHandler, i as CommandOptions, n as CliModuleOptions, r as Command, t as CliModule } from "./cli-module.decorator-CRaNGvgl.cjs";
1
+ import { a as CommandHandler, i as CommandOptions, n as CliModuleOptions, r as Command, t as CliModule } from "./cli-module.decorator-BzsOEMPH.cjs";
2
2
  import { AbstractAdapterInterface, AdapterEnvironment, AnyInjectableType, ClassType, ClassTypeWithInstance, InjectionToken, LogLevel, ModuleMetadata, NaviosApplication, NaviosModule } from "@navios/core";
3
- import { ZodObject, z } from "zod";
3
+ import { z } from "zod/v4";
4
4
  export * from "@navios/core";
5
5
 
6
6
  //#region src/commands/help.command.d.mts
@@ -28,44 +28,44 @@ declare class HelpCommand implements CommandHandler<HelpOptions> {
28
28
  */
29
29
  interface AbstractCliAdapterInterface extends AbstractAdapterInterface {
30
30
  /**
31
- * Run the CLI application with the given arguments.
32
- * Parses arguments and executes the matching command.
33
- *
34
- * @param argv - Command-line arguments array (defaults to `process.argv`)
35
- *
36
- * @example
37
- * ```typescript
38
- * const adapter = app.getAdapter() as AbstractCliAdapterInterface
39
- * await adapter.run(process.argv)
40
- * ```
41
- */
31
+ * Run the CLI application with the given arguments.
32
+ * Parses arguments and executes the matching command.
33
+ *
34
+ * @param argv - Command-line arguments array (defaults to `process.argv`)
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const adapter = app.getAdapter() as AbstractCliAdapterInterface
39
+ * await adapter.run(process.argv)
40
+ * ```
41
+ */
42
42
  run(argv?: string[]): Promise<void>;
43
43
  /**
44
- * Execute a command programmatically with the provided options.
45
- *
46
- * @param path - The command path (e.g., 'greet', 'user:create')
47
- * @param options - The command options object
48
- *
49
- * @example
50
- * ```typescript
51
- * await adapter.executeCommand('user:create', {
52
- * name: 'John',
53
- * email: 'john@example.com',
54
- * })
55
- * ```
56
- */
44
+ * Execute a command programmatically with the provided options.
45
+ *
46
+ * @param path - The command path (e.g., 'greet', 'user:create')
47
+ * @param options - The command options object
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * await adapter.executeCommand('user:create', {
52
+ * name: 'John',
53
+ * email: 'john@example.com',
54
+ * })
55
+ * ```
56
+ */
57
57
  executeCommand(path: string, options: Record<string, unknown>): Promise<void>;
58
58
  /**
59
- * Get all registered command paths and their class references.
60
- *
61
- * @returns Array of objects containing path and class
62
- *
63
- * @example
64
- * ```typescript
65
- * const commands = adapter.getAllCommands()
66
- * commands.forEach(({ path }) => console.log(path))
67
- * ```
68
- */
59
+ * Get all registered command paths and their class references.
60
+ *
61
+ * @returns Array of objects containing path and class
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * const commands = adapter.getAllCommands()
66
+ * commands.forEach(({ path }) => console.log(path))
67
+ * ```
68
+ */
69
69
  getAllCommands(): Array<{
70
70
  path: string;
71
71
  class: unknown;
@@ -109,39 +109,39 @@ interface CliEnvironment extends AdapterEnvironment {
109
109
  */
110
110
  interface CommanderLoggerOptions {
111
111
  /**
112
- * Enabled log levels.
113
- * @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']
114
- */
112
+ * Enabled log levels.
113
+ * @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']
114
+ */
115
115
  logLevels?: LogLevel[];
116
116
  /**
117
- * If true, will print the process ID in the log message.
118
- * @default false
119
- */
117
+ * If true, will print the process ID in the log message.
118
+ * @default false
119
+ */
120
120
  showPid?: boolean;
121
121
  /**
122
- * If true, will print the log level in the log message.
123
- * @default true
124
- */
122
+ * If true, will print the log level in the log message.
123
+ * @default true
124
+ */
125
125
  showLogLevel?: boolean;
126
126
  /**
127
- * If true, will print the prefix/app name in the log message.
128
- * @default false
129
- */
127
+ * If true, will print the prefix/app name in the log message.
128
+ * @default false
129
+ */
130
130
  showPrefix?: boolean;
131
131
  /**
132
- * If true, will print the context in the log message.
133
- * @default true
134
- */
132
+ * If true, will print the context in the log message.
133
+ * @default true
134
+ */
135
135
  showContext?: boolean;
136
136
  /**
137
- * If true, will print the absolute timestamp in the log message.
138
- * @default false
139
- */
137
+ * If true, will print the absolute timestamp in the log message.
138
+ * @default false
139
+ */
140
140
  showTimestamp?: boolean;
141
141
  /**
142
- * If enabled, will print timestamp difference between current and previous log message.
143
- * @default false
144
- */
142
+ * If enabled, will print timestamp difference between current and previous log message.
143
+ * @default false
144
+ */
145
145
  showTimeDiff?: boolean;
146
146
  }
147
147
  /**
@@ -152,52 +152,52 @@ interface CommanderLoggerOptions {
152
152
  */
153
153
  interface CommanderTuiOptions {
154
154
  /**
155
- * Exit on Ctrl+C.
156
- * @default true
157
- */
155
+ * Exit on Ctrl+C.
156
+ * @default true
157
+ */
158
158
  exitOnCtrlC?: boolean;
159
159
  /**
160
- * Adapter to use for the TUI.
161
- * @default 'none'
162
- */
160
+ * Adapter to use for the TUI.
161
+ * @default 'none'
162
+ */
163
163
  adapter?: 'react' | 'solid' | 'ink' | 'none';
164
164
  /**
165
- * Sidebar width in columns.
166
- */
165
+ * Sidebar width in columns.
166
+ */
167
167
  sidebarWidth?: number;
168
168
  /**
169
- * Sidebar position.
170
- */
169
+ * Sidebar position.
170
+ */
171
171
  sidebarPosition?: 'left' | 'right';
172
172
  /**
173
- * Sidebar header title.
174
- */
173
+ * Sidebar header title.
174
+ */
175
175
  sidebarTitle?: string;
176
176
  /**
177
- * Auto close after all screens complete successfully.
178
- * Set to true for default delay (5000ms), or specify delay in milliseconds.
179
- */
177
+ * Auto close after all screens complete successfully.
178
+ * Set to true for default delay (5000ms), or specify delay in milliseconds.
179
+ */
180
180
  autoClose?: boolean | number;
181
181
  /**
182
- * Theme preset name ('dark', 'light', 'high-contrast') or custom theme object.
183
- */
182
+ * Theme preset name ('dark', 'light', 'high-contrast') or custom theme object.
183
+ */
184
184
  theme?: string | Record<string, unknown>;
185
185
  /**
186
- * Enable mouse support.
187
- * @default false
188
- */
186
+ * Enable mouse support.
187
+ * @default false
188
+ */
189
189
  useMouse?: boolean;
190
190
  /**
191
- * Hide the default console logger screen from the sidebar.
192
- * @default false
193
- */
191
+ * Hide the default console logger screen from the sidebar.
192
+ * @default false
193
+ */
194
194
  hideDefaultScreen?: boolean;
195
195
  /**
196
- * Use OpenTUI for terminal rendering.
197
- * When true: Full TUI with sidebar, scrolling, interactive prompts.
198
- * When false: Stdout mode - static screens print immediately, others on completion.
199
- * @default true for Node.js, false for Bun (OpenTUI not supported)
200
- */
196
+ * Use OpenTUI for terminal rendering.
197
+ * When true: Full TUI with sidebar, scrolling, interactive prompts.
198
+ * When false: Stdout mode - static screens print immediately, others on completion.
199
+ * @default true for Node.js, false for Bun (OpenTUI not supported)
200
+ */
201
201
  useOpenTUI?: boolean;
202
202
  }
203
203
  /**
@@ -207,23 +207,23 @@ interface CommanderTuiOptions {
207
207
  */
208
208
  interface CommanderFactoryOptions {
209
209
  /**
210
- * Enabled log levels.
211
- * @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']
212
- */
210
+ * Enabled log levels.
211
+ * @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']
212
+ */
213
213
  logLevels?: LogLevel[];
214
214
  /**
215
- * Logger display options. These override the default CLI-friendly logger settings.
216
- * Ignored when enableTUI is true.
217
- */
215
+ * Logger display options. These override the default CLI-friendly logger settings.
216
+ * Ignored when enableTUI is true.
217
+ */
218
218
  logger?: CommanderLoggerOptions;
219
219
  /**
220
- * Enable TUI mode with @navios/commander-tui.
221
- * Requires @navios/commander-tui to be installed.
222
- */
220
+ * Enable TUI mode with @navios/commander-tui.
221
+ * Requires @navios/commander-tui to be installed.
222
+ */
223
223
  enableTUI?: boolean;
224
224
  /**
225
- * TUI-specific options. Only used when enableTUI is true.
226
- */
225
+ * TUI-specific options. Only used when enableTUI is true.
226
+ */
227
227
  tuiOptions?: CommanderTuiOptions;
228
228
  }
229
229
  /**
@@ -262,21 +262,21 @@ interface CommanderFactoryOptions {
262
262
  */
263
263
  declare class CommanderFactory {
264
264
  /**
265
- * Creates a new CLI application instance configured with the provided module.
266
- *
267
- * @param appModule - The root CLI module class decorated with `@CliModule`
268
- * @param options - Optional configuration options for the CLI application
269
- * @returns A promise that resolves to a configured NaviosApplication instance
270
- *
271
- * @example
272
- * ```typescript
273
- * const app = await CommanderFactory.create(AppModule)
274
- * await app.init()
275
- *
276
- * const adapter = app.getAdapter()
277
- * await adapter.run(process.argv)
278
- * ```
279
- */
265
+ * Creates a new CLI application instance configured with the provided module.
266
+ *
267
+ * @param appModule - The root CLI module class decorated with `@CliModule`
268
+ * @param options - Optional configuration options for the CLI application
269
+ * @returns A promise that resolves to a configured NaviosApplication instance
270
+ *
271
+ * @example
272
+ * ```typescript
273
+ * const app = await CommanderFactory.create(AppModule)
274
+ * await app.init()
275
+ *
276
+ * const adapter = app.getAdapter()
277
+ * await adapter.run(process.argv)
278
+ * ```
279
+ */
280
280
  static create<TModule extends NaviosModule = NaviosModule>(appModule: ClassTypeWithInstance<TModule>, options?: CommanderFactoryOptions): Promise<NaviosApplication<CliEnvironment>>;
281
281
  }
282
282
  //#endregion
@@ -293,20 +293,20 @@ declare const CommandMetadataKey: unique symbol;
293
293
  */
294
294
  interface CommandMetadata {
295
295
  /**
296
- * The command path (e.g., 'greet', 'user:create').
297
- */
296
+ * The command path (e.g., 'greet', 'user:create').
297
+ */
298
298
  path: string;
299
299
  /**
300
- * Optional description of the command for help text.
301
- */
300
+ * Optional description of the command for help text.
301
+ */
302
302
  description?: string;
303
303
  /**
304
- * Optional Zod schema for validating command options.
305
- */
306
- optionsSchema?: ZodObject;
304
+ * Optional zod/v4 schema for validating command options.
305
+ */
306
+ optionsSchema?: z.ZodObject;
307
307
  /**
308
- * Map of custom attributes that can be attached to the command.
309
- */
308
+ * Map of custom attributes that can be attached to the command.
309
+ */
310
310
  customAttributes: Map<string | symbol, any>;
311
311
  }
312
312
  /**
@@ -317,10 +317,10 @@ interface CommandMetadata {
317
317
  * @param context - The decorator context
318
318
  * @param path - The command path
319
319
  * @param description - Optional description for help text
320
- * @param optionsSchema - Optional Zod schema
320
+ * @param optionsSchema - Optional zod/v4 schema
321
321
  * @returns The command metadata
322
322
  */
323
- declare function getCommandMetadata(target: ClassType, context: ClassDecoratorContext, path: string, description?: string, optionsSchema?: ZodObject): CommandMetadata;
323
+ declare function getCommandMetadata(target: ClassType, context: ClassDecoratorContext, path: string, description?: string, optionsSchema?: z.ZodObject): CommandMetadata;
324
324
  /**
325
325
  * Extracts command metadata from a class.
326
326
  *
@@ -371,84 +371,105 @@ declare class CommanderExecutionContext {
371
371
  private readonly commandPath;
372
372
  private readonly options;
373
373
  /**
374
- * @internal
375
- * Creates a new execution context.
376
- */
374
+ * @internal
375
+ * Creates a new execution context.
376
+ */
377
377
  constructor(command: CommandMetadata, commandPath: string, options: any);
378
378
  /**
379
- * Gets the command metadata.
380
- *
381
- * @returns The command metadata including path and options schema
382
- */
379
+ * Gets the command metadata.
380
+ *
381
+ * @returns The command metadata including path and options schema
382
+ */
383
383
  getCommand(): CommandMetadata;
384
384
  /**
385
- * Gets the command path that was invoked.
386
- *
387
- * @returns The command path (e.g., 'greet', 'user:create')
388
- */
385
+ * Gets the command path that was invoked.
386
+ *
387
+ * @returns The command path (e.g., 'greet', 'user:create')
388
+ */
389
389
  getCommandPath(): string;
390
390
  /**
391
- * Gets the validated command options.
392
- *
393
- * Options are validated against the command's Zod schema if one was provided.
394
- *
395
- * @returns The validated options object
396
- */
391
+ * Gets the validated command options.
392
+ *
393
+ * Options are validated against the command's zod/v4 schema if one was provided.
394
+ *
395
+ * @returns The validated options object
396
+ */
397
397
  getOptions(): any;
398
398
  }
399
399
  //#endregion
400
- //#region src/services/commander-adapter.service.d.mts
400
+ //#region src/services/cli-parser.service.d.mts
401
401
  /**
402
- * CLI adapter service that implements the AbstractCliAdapterInterface.
403
- * Handles command discovery, registration, parsing, and execution.
402
+ * Result of parsing command-line arguments.
404
403
  *
405
404
  * @public
406
405
  */
407
- declare class CommanderAdapterService implements AbstractCliAdapterInterface {
408
- private container;
409
- private commandRegistry;
410
- private cliParser;
411
- private logger;
412
- private options;
413
- private isReady;
406
+ interface ParsedCliArgs {
414
407
  /**
415
- * Sets up the adapter with the provided options.
416
- * Called during application initialization.
417
- */
418
- setupAdapter(options: CliAdapterOptions): Promise<void>;
408
+ * The command path (e.g., 'greet', 'user:create').
409
+ * Multi-word commands are joined with spaces.
410
+ */
411
+ command: string;
419
412
  /**
420
- * Called after all modules are loaded.
421
- * Iterates through modules and extracts commands from customEntries.
422
- */
423
- onModulesInit(modules: Map<string, ModuleMetadata>): Promise<void>;
413
+ * Parsed options as key-value pairs.
414
+ * Keys are converted from kebab-case to camelCase.
415
+ */
416
+ options: Record<string, any>;
424
417
  /**
425
- * Registers built-in commands like help.
426
- */
427
- private registerBuiltInCommands;
418
+ * Positional arguments that don't match any option flags.
419
+ */
420
+ positionals: string[];
421
+ }
422
+ /**
423
+ * Service for parsing command-line arguments.
424
+ *
425
+ * Handles parsing of various CLI argument formats including:
426
+ * - Long options: `--key value` or `--key=value`
427
+ * - Short options: `-k value` or `-abc` (multiple flags)
428
+ * - Boolean flags
429
+ * - Array options
430
+ * - Positional arguments
431
+ *
432
+ * @public
433
+ */
434
+ declare class CliParserService {
428
435
  /**
429
- * Signals that the adapter is ready to handle commands.
430
- */
431
- ready(): Promise<void>;
436
+ * Parses command-line arguments from process.argv
437
+ * Commands can be multi-word (e.g., 'db migrate', 'cache clear')
438
+ * Expected format: node script.js command [subcommand...] --flag value --boolean-flag positional1 positional2
439
+ *
440
+ * @param argv - Array of command-line arguments (typically process.argv)
441
+ * @param optionsSchema - Optional zod/v4 schema to determine boolean flags and option types
442
+ * @returns Parsed command (space-separated if multi-word), options, and positional arguments
443
+ */
444
+ parse(argv: string[], optionsSchema?: z.ZodObject): ParsedCliArgs;
445
+ /**
446
+ * Converts kebab-case to camelCase
447
+ */
448
+ private camelCase;
432
449
  /**
433
- * Disposes of the adapter and cleans up resources.
434
- */
435
- dispose(): Promise<void>;
450
+ * Attempts to parse string values into appropriate types
451
+ */
452
+ private parseValue;
436
453
  /**
437
- * Run the CLI application with the given arguments.
438
- * Parses arguments and executes the matching command.
439
- */
440
- run(argv?: string[]): Promise<void>;
454
+ * Extracts boolean field names from a zod/v4 schema
455
+ * Handles z.ZodObject, zod/v4Optional, and zod/v4Default wrappers
456
+ */
457
+ private extractBooleanFields;
441
458
  /**
442
- * Execute a command programmatically with the provided options.
443
- */
444
- executeCommand(path: string, options?: Record<string, unknown>): Promise<void>;
459
+ * Extracts array field names from a zod/v4 schema
460
+ * Handles z.ZodObject, zod/v4Optional, and zod/v4Default wrappers
461
+ */
462
+ private extractArrayFields;
445
463
  /**
446
- * Get all registered command paths and their class references.
447
- */
448
- getAllCommands(): Array<{
449
- path: string;
450
- class: ClassType;
451
- }>;
464
+ * Checks if a zod/v4 schema represents a boolean type
465
+ * Unwraps zod/v4Optional and zod/v4Default using zod/v4 v4 API
466
+ */
467
+ private isSchemaBoolean;
468
+ /**
469
+ * Checks if a zod/v4 schema represents an array type
470
+ * Unwraps zod/v4Optional and zod/v4Default using zod/v4 v4 API
471
+ */
472
+ private isSchemaArray;
452
473
  }
453
474
  //#endregion
454
475
  //#region src/metadata/command-entry.metadata.d.mts
@@ -490,16 +511,16 @@ declare function extractModuleCommands(moduleClass: ClassType): Set<ClassType>;
490
511
  */
491
512
  interface RegisteredCommand {
492
513
  /**
493
- * The command class
494
- */
514
+ * The command class
515
+ */
495
516
  class: ClassType;
496
517
  /**
497
- * The command metadata from @Command decorator
498
- */
518
+ * The command metadata from @Command decorator
519
+ */
499
520
  metadata: CommandMetadata;
500
521
  /**
501
- * Name of the module this command belongs to
502
- */
522
+ * Name of the module this command belongs to
523
+ */
503
524
  moduleName: string;
504
525
  }
505
526
  /**
@@ -511,138 +532,117 @@ interface RegisteredCommand {
511
532
  declare class CommandRegistryService {
512
533
  private commands;
513
534
  /**
514
- * Register a command with its metadata.
515
- *
516
- * @param path - The command path (e.g., 'greet', 'user:create')
517
- * @param command - The registered command data
518
- * @throws Error if a command with the same path is already registered
519
- */
535
+ * Register a command with its metadata.
536
+ *
537
+ * @param path - The command path (e.g., 'greet', 'user:create')
538
+ * @param command - The registered command data
539
+ * @throws Error if a command with the same path is already registered
540
+ */
520
541
  register(path: string, command: RegisteredCommand): void;
521
542
  /**
522
- * Get a command by its path.
523
- *
524
- * @param path - The command path
525
- * @returns The registered command or undefined if not found
526
- */
543
+ * Get a command by its path.
544
+ *
545
+ * @param path - The command path
546
+ * @returns The registered command or undefined if not found
547
+ */
527
548
  getByPath(path: string): RegisteredCommand | undefined;
528
549
  /**
529
- * Get all registered commands.
530
- *
531
- * @returns Map of path to registered command
532
- */
550
+ * Get all registered commands.
551
+ *
552
+ * @returns Map of path to registered command
553
+ */
533
554
  getAll(): Map<string, RegisteredCommand>;
534
555
  /**
535
- * Get all registered commands as an array of path and class pairs.
536
- * Useful for listing available commands.
537
- *
538
- * @returns Array of objects containing path and class
539
- */
556
+ * Get all registered commands as an array of path and class pairs.
557
+ * Useful for listing available commands.
558
+ *
559
+ * @returns Array of objects containing path and class
560
+ */
540
561
  getAllAsArray(): Array<{
541
562
  path: string;
542
563
  class: ClassType;
543
564
  }>;
544
565
  /**
545
- * Formats help text listing all available commands with descriptions.
546
- *
547
- * @returns Formatted string listing all commands
548
- */
566
+ * Formats help text listing all available commands with descriptions.
567
+ *
568
+ * @returns Formatted string listing all commands
569
+ */
549
570
  formatCommandList(): string;
550
571
  /**
551
- * Formats help text for a specific command.
552
- *
553
- * @param commandPath - The command path to show help for
554
- * @returns Formatted string with command help
555
- */
572
+ * Formats help text for a specific command.
573
+ *
574
+ * @param commandPath - The command path to show help for
575
+ * @returns Formatted string with command help
576
+ */
556
577
  formatCommandHelp(commandPath: string): string;
557
578
  /**
558
- * Gets a human-readable type name from a Zod schema.
559
- */
579
+ * Gets a human-readable type name from a zod/v4 schema.
580
+ */
560
581
  private getSchemaTypeName;
561
582
  /**
562
- * Gets metadata from a Zod schema, traversing innerType if needed.
563
- * Zod v4 stores meta at the outermost layer when .meta() is called last,
564
- * or in innerType when .meta() is called before .optional()/.default().
565
- */
583
+ * Gets metadata from a zod/v4 schema, traversing innerType if needed.
584
+ * zod/v4 v4 stores meta at the outermost layer when .meta() is called last,
585
+ * or in innerType when .meta() is called before .optional()/.default().
586
+ */
566
587
  private getSchemaMeta;
567
588
  /**
568
- * Clear all registered commands.
569
- */
589
+ * Clear all registered commands.
590
+ */
570
591
  clear(): void;
571
592
  }
572
593
  //#endregion
573
- //#region src/services/cli-parser.service.d.mts
594
+ //#region src/services/commander-adapter.service.d.mts
574
595
  /**
575
- * Result of parsing command-line arguments.
596
+ * CLI adapter service that implements the AbstractCliAdapterInterface.
597
+ * Handles command discovery, registration, parsing, and execution.
576
598
  *
577
599
  * @public
578
600
  */
579
- interface ParsedCliArgs {
580
- /**
581
- * The command path (e.g., 'greet', 'user:create').
582
- * Multi-word commands are joined with spaces.
583
- */
584
- command: string;
601
+ declare class CommanderAdapterService implements AbstractCliAdapterInterface {
602
+ private container;
603
+ private commandRegistry;
604
+ private cliParser;
605
+ private logger;
606
+ private options;
607
+ private isReady;
585
608
  /**
586
- * Parsed options as key-value pairs.
587
- * Keys are converted from kebab-case to camelCase.
588
- */
589
- options: Record<string, any>;
609
+ * Sets up the adapter with the provided options.
610
+ * Called during application initialization.
611
+ */
612
+ setupAdapter(options: CliAdapterOptions): Promise<void>;
590
613
  /**
591
- * Positional arguments that don't match any option flags.
592
- */
593
- positionals: string[];
594
- }
595
- /**
596
- * Service for parsing command-line arguments.
597
- *
598
- * Handles parsing of various CLI argument formats including:
599
- * - Long options: `--key value` or `--key=value`
600
- * - Short options: `-k value` or `-abc` (multiple flags)
601
- * - Boolean flags
602
- * - Array options
603
- * - Positional arguments
604
- *
605
- * @public
606
- */
607
- declare class CliParserService {
614
+ * Called after all modules are loaded.
615
+ * Iterates through modules and extracts commands from customEntries.
616
+ */
617
+ onModulesInit(modules: Map<string, ModuleMetadata>): Promise<void>;
608
618
  /**
609
- * Parses command-line arguments from process.argv
610
- * Commands can be multi-word (e.g., 'db migrate', 'cache clear')
611
- * Expected format: node script.js command [subcommand...] --flag value --boolean-flag positional1 positional2
612
- *
613
- * @param argv - Array of command-line arguments (typically process.argv)
614
- * @param optionsSchema - Optional Zod schema to determine boolean flags and option types
615
- * @returns Parsed command (space-separated if multi-word), options, and positional arguments
616
- */
617
- parse(argv: string[], optionsSchema?: ZodObject): ParsedCliArgs;
618
- /**
619
- * Converts kebab-case to camelCase
620
- */
621
- private camelCase;
619
+ * Registers built-in commands like help.
620
+ */
621
+ private registerBuiltInCommands;
622
622
  /**
623
- * Attempts to parse string values into appropriate types
624
- */
625
- private parseValue;
623
+ * Signals that the adapter is ready to handle commands.
624
+ */
625
+ ready(): Promise<void>;
626
626
  /**
627
- * Extracts boolean field names from a Zod schema
628
- * Handles ZodObject, ZodOptional, and ZodDefault wrappers
629
- */
630
- private extractBooleanFields;
627
+ * Disposes of the adapter and cleans up resources.
628
+ */
629
+ dispose(): Promise<void>;
631
630
  /**
632
- * Extracts array field names from a Zod schema
633
- * Handles ZodObject, ZodOptional, and ZodDefault wrappers
634
- */
635
- private extractArrayFields;
631
+ * Run the CLI application with the given arguments.
632
+ * Parses arguments and executes the matching command.
633
+ */
634
+ run(argv?: string[]): Promise<void>;
636
635
  /**
637
- * Checks if a Zod schema represents a boolean type
638
- * Unwraps ZodOptional and ZodDefault using Zod v4 API
639
- */
640
- private isSchemaBoolean;
636
+ * Execute a command programmatically with the provided options.
637
+ */
638
+ executeCommand(path: string, options?: Record<string, unknown>): Promise<void>;
641
639
  /**
642
- * Checks if a Zod schema represents an array type
643
- * Unwraps ZodOptional and ZodDefault using Zod v4 API
644
- */
645
- private isSchemaArray;
640
+ * Get all registered command paths and their class references.
641
+ */
642
+ getAllCommands(): Array<{
643
+ path: string;
644
+ class: ClassType;
645
+ }>;
646
646
  }
647
647
  //#endregion
648
648
  //#region src/define-environment.d.mts