@navios/commander 1.5.0 → 1.6.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 (121) hide show
  1. package/.turbo/turbo-build.log +48 -0
  2. package/.turbo/turbo-check.log +0 -0
  3. package/.turbo/turbo-lint.log +2 -0
  4. package/.turbo/turbo-test$colon$ci.log +109 -0
  5. package/.turbo/turbo-test.log +107 -0
  6. package/CHANGELOG.md +15 -3
  7. package/README.md +8 -16
  8. package/dist/src/commander.factory.d.mts +126 -122
  9. package/dist/src/commander.factory.d.mts.map +1 -1
  10. package/dist/src/commands/help.command.d.mts +15 -11
  11. package/dist/src/commands/help.command.d.mts.map +1 -1
  12. package/dist/src/commands/index.d.mts +2 -2
  13. package/dist/src/decorators/cli-module.decorator.d.mts +51 -40
  14. package/dist/src/decorators/cli-module.decorator.d.mts.map +1 -1
  15. package/dist/src/decorators/command.decorator.d.mts +49 -37
  16. package/dist/src/decorators/command.decorator.d.mts.map +1 -1
  17. package/dist/src/decorators/index.d.mts +3 -3
  18. package/dist/src/define-environment.d.mts +9 -8
  19. package/dist/src/define-environment.d.mts.map +1 -1
  20. package/dist/src/index.d.mts +10 -10
  21. package/dist/src/interfaces/abstract-cli-adapter.interface.d.mts +45 -45
  22. package/dist/src/interfaces/command-handler.interface.d.mts +14 -10
  23. package/dist/src/interfaces/command-handler.interface.d.mts.map +1 -1
  24. package/dist/src/interfaces/commander-execution-context.interface.d.mts +40 -30
  25. package/dist/src/interfaces/commander-execution-context.interface.d.mts.map +1 -1
  26. package/dist/src/interfaces/environment.interface.d.mts +7 -7
  27. package/dist/src/interfaces/index.d.mts +5 -5
  28. package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts +6 -5
  29. package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts.map +1 -1
  30. package/dist/src/legacy-compat/decorators/command.decorator.d.mts +7 -6
  31. package/dist/src/legacy-compat/decorators/command.decorator.d.mts.map +1 -1
  32. package/dist/src/legacy-compat/decorators/index.d.mts +3 -3
  33. package/dist/src/legacy-compat/index.d.mts +3 -3
  34. package/dist/src/metadata/command-entry.metadata.d.mts +5 -5
  35. package/dist/src/metadata/command-entry.metadata.d.mts.map +1 -1
  36. package/dist/src/metadata/command.metadata.d.mts +30 -24
  37. package/dist/src/metadata/command.metadata.d.mts.map +1 -1
  38. package/dist/src/metadata/index.d.mts +3 -3
  39. package/dist/src/overrides/help.command.d.mts +15 -11
  40. package/dist/src/overrides/help.command.d.mts.map +1 -1
  41. package/dist/src/services/cli-parser.service.d.mts +54 -54
  42. package/dist/src/services/cli-parser.service.d.mts.map +1 -1
  43. package/dist/src/services/command-registry.service.d.mts +75 -74
  44. package/dist/src/services/command-registry.service.d.mts.map +1 -1
  45. package/dist/src/services/commander-adapter.service.d.mts +53 -48
  46. package/dist/src/services/commander-adapter.service.d.mts.map +1 -1
  47. package/dist/src/services/index.d.mts +4 -4
  48. package/dist/src/tokens/execution-context.token.d.mts +9 -4
  49. package/dist/src/tokens/execution-context.token.d.mts.map +1 -1
  50. package/dist/src/tokens/help-command.token.d.mts +5 -4
  51. package/dist/src/tokens/index.d.mts +2 -2
  52. package/dist/src/utils/index.d.mts +2 -2
  53. package/dist/src/utils/runtime.d.mts +2 -2
  54. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/dist/tsdown.config.d.mts +3 -3
  57. package/dist/vitest.config.d.mts +3 -3
  58. package/lib/{cli-module.decorator-CRaNGvgl.d.cts → cli-module.decorator-BV3vVKlR.d.cts} +60 -55
  59. package/lib/cli-module.decorator-BV3vVKlR.d.cts.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/{cli-module.decorator-bsP5gEn7.d.mts → cli-module.decorator-DDlgpTgI.d.mts} +133 -118
  65. package/lib/cli-module.decorator-DDlgpTgI.d.mts.map +1 -0
  66. package/lib/{command.decorator-UrNJmQN0.cjs → command.decorator-HziankUv.cjs} +3 -3
  67. package/lib/command.decorator-HziankUv.cjs.map +1 -0
  68. package/lib/{command.decorator-DVLSAqYZ.mjs → command.decorator-QiRU7ny3.mjs} +3 -3
  69. package/lib/command.decorator-QiRU7ny3.mjs.map +1 -0
  70. package/lib/{help-command.token-CMWYI6em.cjs → help-command.token-DamE31Aw.cjs} +4 -4
  71. package/lib/{help-command.token-CMWYI6em.cjs.map → help-command.token-DamE31Aw.cjs.map} +1 -1
  72. package/lib/{help-command.token-C0Kgj60o.mjs → help-command.token-XHx3WkoD.mjs} +4 -4
  73. package/lib/{help-command.token-C0Kgj60o.mjs.map → help-command.token-XHx3WkoD.mjs.map} +1 -1
  74. package/lib/{help.command-dtZbhq0w.mjs → help.command-Bynoll_7.mjs} +5 -8
  75. package/lib/help.command-Bynoll_7.mjs.map +1 -0
  76. package/lib/{help.command-DQyv6ali.cjs → help.command-DvKmMpB7.cjs} +6 -9
  77. package/lib/help.command-DvKmMpB7.cjs.map +1 -0
  78. package/lib/index.cjs +118 -106
  79. package/lib/index.cjs.map +1 -1
  80. package/lib/index.d.cts +294 -284
  81. package/lib/index.d.cts.map +1 -1
  82. package/lib/index.d.mts +221 -221
  83. package/lib/index.d.mts.map +1 -1
  84. package/lib/index.mjs +117 -105
  85. package/lib/index.mjs.map +1 -1
  86. package/lib/legacy-compat/index.cjs +6 -28
  87. package/lib/legacy-compat/index.cjs.map +1 -1
  88. package/lib/legacy-compat/index.d.cts +3 -2
  89. package/lib/legacy-compat/index.d.cts.map +1 -1
  90. package/lib/legacy-compat/index.d.mts +3 -2
  91. package/lib/legacy-compat/index.d.mts.map +1 -1
  92. package/lib/legacy-compat/index.mjs +4 -25
  93. package/lib/legacy-compat/index.mjs.map +1 -1
  94. package/package.json +26 -16
  95. package/src/__tests__/commander.factory.e2e.spec.mts +127 -79
  96. package/src/commands/help.command.mts +1 -1
  97. package/src/decorators/cli-module.decorator.mts +4 -9
  98. package/src/decorators/command.decorator.mts +4 -4
  99. package/src/define-environment.mts +4 -4
  100. package/src/interfaces/command-handler.interface.mts +8 -4
  101. package/src/interfaces/commander-execution-context.interface.mts +14 -1
  102. package/src/legacy-compat/decorators/cli-module.decorator.mts +2 -1
  103. package/src/legacy-compat/decorators/command.decorator.mts +3 -2
  104. package/src/metadata/command-entry.metadata.mts +3 -6
  105. package/src/metadata/command.metadata.mts +6 -8
  106. package/src/overrides/help.command.mts +2 -2
  107. package/src/services/__tests__/cli-parser.service.spec.mts +23 -178
  108. package/src/services/cli-parser.service.mts +23 -27
  109. package/src/services/command-registry.service.mts +5 -5
  110. package/src/services/commander-adapter.service.mts +12 -20
  111. package/src/tokens/execution-context.token.mts +4 -6
  112. package/tsconfig.json +3 -0
  113. package/lib/cli-module.decorator-CRaNGvgl.d.cts.map +0 -1
  114. package/lib/cli-module.decorator-CkP22084.cjs.map +0 -1
  115. package/lib/cli-module.decorator-UGbtkRYc.mjs.map +0 -1
  116. package/lib/cli-module.decorator-bsP5gEn7.d.mts.map +0 -1
  117. package/lib/command.decorator-DVLSAqYZ.mjs.map +0 -1
  118. package/lib/command.decorator-UrNJmQN0.cjs.map +0 -1
  119. package/lib/help.command-DQyv6ali.cjs.map +0 -1
  120. package/lib/help.command-dtZbhq0w.mjs.map +0 -1
  121. package/project.json +0 -66
@@ -1,8 +1,9 @@
1
- import { i as CommandOptions, n as CliModuleOptions } from "../cli-module.decorator-CRaNGvgl.cjs";
1
+ import { i as CommandOptions, n as CliModuleOptions } from "../cli-module.decorator-BV3vVKlR.cjs";
2
2
  import { ClassType } from "@navios/core";
3
3
  export * from "@navios/core/legacy-compat";
4
4
 
5
5
  //#region src/legacy-compat/decorators/command.decorator.d.mts
6
+
6
7
  /**
7
8
  * Legacy-compatible Command decorator.
8
9
  *
@@ -14,7 +15,7 @@ export * from "@navios/core/legacy-compat";
14
15
  * @example
15
16
  * ```typescript
16
17
  * import { Command, CommandHandler } from '@navios/commander/legacy-compat'
17
- * import { z } from 'zod'
18
+ * import { z } from 'zod/v4'
18
19
  *
19
20
  * const optionsSchema = z.object({
20
21
  * name: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["ClassType","CommandOptions","Command","ClassType","CliModuleOptions","CliModule"],"sources":["../../src/legacy-compat/decorators/command.decorator.d.mts","../../src/legacy-compat/decorators/cli-module.decorator.d.mts"],"mappings":";;;;;;AAgCA;;;;ACRA;;;;;;;;;;;;;;;;;;;;;;;;iBDQwBE,OAAAA,CAAAA,OAAAA,EAAiBD,cAAAA,IAAAA,MAAAA,EAA0BD,SAAAA;;;;ACRnE;;;;;;;;;;;;;;;;;;;;iBAAwBK,SAAAA,CAAAA,OAAAA,GAAoBD,gBAAAA,IAAAA,MAAAA,EAA4BD,SAAAA,KAAcA,SAAAA"}
1
+ {"version":3,"file":"index.d.cts","names":["ClassType","CommandOptions","Command","ClassType","CliModuleOptions","CliModule"],"sources":["../../src/legacy-compat/decorators/command.decorator.d.mts","../../src/legacy-compat/decorators/cli-module.decorator.d.mts"],"sourcesContent":["import type { ClassType } from '@navios/core'\n\nimport { type CommandOptions } from '../../decorators/command.decorator.mjs'\nexport type { CommandOptions }\n/**\n * Legacy-compatible Command decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Command configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * import { Command, CommandHandler } from '@navios/commander/legacy-compat'\n * import { z } from 'zod/v4'\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(options: CommandOptions): (target: ClassType) => any\n//# sourceMappingURL=command.decorator.d.mts.map\n","import type { ClassType } from '@navios/core'\n\nimport { type CliModuleOptions } from '../../decorators/cli-module.decorator.mjs'\nexport type { CliModuleOptions }\n/**\n * Legacy-compatible CliModule decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - CLI module configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * import { CliModule } from '@navios/commander/legacy-compat'\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 */\nexport declare function CliModule(options?: CliModuleOptions): (target: ClassType) => ClassType\n//# sourceMappingURL=cli-module.decorator.d.mts.map\n"],"mappings":";;;;;;;;AAiCA;;;;ACRA;;;;;;;;;;;;;;;;;;;;;;;iBDQwBE,OAAAA,UAAiBD,0BAA0BD;;;;;AAAnE;;;;ACRA;;;;;;;;;;;;;;;iBAAwBK,SAAAA,WAAoBD,4BAA4BD,cAAcA"}
@@ -1,8 +1,9 @@
1
- import { i as CommandOptions, n as CliModuleOptions } from "../cli-module.decorator-bsP5gEn7.mjs";
1
+ import { i as CommandOptions, n as CliModuleOptions } from "../cli-module.decorator-DDlgpTgI.mjs";
2
2
  import { ClassType } from "@navios/core";
3
3
  export * from "@navios/core/legacy-compat";
4
4
 
5
5
  //#region src/legacy-compat/decorators/command.decorator.d.mts
6
+
6
7
  /**
7
8
  * Legacy-compatible Command decorator.
8
9
  *
@@ -14,7 +15,7 @@ export * from "@navios/core/legacy-compat";
14
15
  * @example
15
16
  * ```typescript
16
17
  * import { Command, CommandHandler } from '@navios/commander/legacy-compat'
17
- * import { z } from 'zod'
18
+ * import { z } from 'zod/v4'
18
19
  *
19
20
  * const optionsSchema = z.object({
20
21
  * name: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":["ClassType","CommandOptions","Command","ClassType","CliModuleOptions","CliModule"],"sources":["../../src/legacy-compat/decorators/command.decorator.d.mts","../../src/legacy-compat/decorators/cli-module.decorator.d.mts"],"mappings":";;;;;;AAgCA;;;;ACRA;;;;;;;;;;;;;;;;;;;;;;;;iBDQwBE,OAAAA,CAAAA,OAAAA,EAAiBD,cAAAA,IAAAA,MAAAA,EAA0BD,SAAAA;;;;ACRnE;;;;;;;;;;;;;;;;;;;;iBAAwBK,SAAAA,CAAAA,OAAAA,GAAoBD,gBAAAA,IAAAA,MAAAA,EAA4BD,SAAAA,KAAcA,SAAAA"}
1
+ {"version":3,"file":"index.d.mts","names":["ClassType","CommandOptions","Command","ClassType","CliModuleOptions","CliModule"],"sources":["../../src/legacy-compat/decorators/command.decorator.d.mts","../../src/legacy-compat/decorators/cli-module.decorator.d.mts"],"sourcesContent":["import type { ClassType } from '@navios/core'\n\nimport { type CommandOptions } from '../../decorators/command.decorator.mjs'\nexport type { CommandOptions }\n/**\n * Legacy-compatible Command decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Command configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * import { Command, CommandHandler } from '@navios/commander/legacy-compat'\n * import { z } from 'zod/v4'\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(options: CommandOptions): (target: ClassType) => any\n//# sourceMappingURL=command.decorator.d.mts.map\n","import type { ClassType } from '@navios/core'\n\nimport { type CliModuleOptions } from '../../decorators/cli-module.decorator.mjs'\nexport type { CliModuleOptions }\n/**\n * Legacy-compatible CliModule decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - CLI module configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * import { CliModule } from '@navios/commander/legacy-compat'\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 */\nexport declare function CliModule(options?: CliModuleOptions): (target: ClassType) => ClassType\n//# sourceMappingURL=cli-module.decorator.d.mts.map\n"],"mappings":";;;;;;;;AAiCA;;;;ACRA;;;;;;;;;;;;;;;;;;;;;;;iBDQwBE,OAAAA,UAAiBD,0BAA0BD;;;;;AAAnE;;;;ACRA;;;;;;;;;;;;;;;iBAAwBK,SAAAA,WAAoBD,4BAA4BD,cAAcA"}
@@ -1,30 +1,9 @@
1
- import { t as Command$1 } from "../command.decorator-DVLSAqYZ.mjs";
2
- import { t as CliModule$1 } from "../cli-module.decorator-UGbtkRYc.mjs";
1
+ import { t as Command$1 } from "../command.decorator-QiRU7ny3.mjs";
2
+ import { t as CliModule$1 } from "../cli-module.decorator-DAjf_r_W.mjs";
3
+ import { createClassContext } from "@navios/core/legacy-compat";
3
4
 
4
5
  export * from "@navios/core/legacy-compat"
5
6
 
6
- //#region ../../node_modules/@navios/di/lib/legacy-compat/index.mjs
7
- /**
8
- * Compatibility layer for converting legacy decorator signatures to Stage 3 format.
9
- *
10
- * This module provides utilities to create mock Stage 3 decorator contexts
11
- * from legacy decorator arguments, and manages metadata storage using WeakMap.
12
- */ const classMetadataMap = /* @__PURE__ */ new WeakMap();
13
- /**
14
- * Creates a mock ClassDecoratorContext for legacy class decorators.
15
- * @internal
16
- */ function createClassContext(target) {
17
- if (!classMetadataMap.has(target)) classMetadataMap.set(target, {});
18
- const metadata = classMetadataMap.get(target);
19
- return {
20
- kind: "class",
21
- name: target.name,
22
- metadata,
23
- addInitializer() {}
24
- };
25
- }
26
-
27
- //#endregion
28
7
  //#region src/legacy-compat/decorators/command.decorator.mts
29
8
  /**
30
9
  * Legacy-compatible Command decorator.
@@ -37,7 +16,7 @@ export * from "@navios/core/legacy-compat"
37
16
  * @example
38
17
  * ```typescript
39
18
  * import { Command, CommandHandler } from '@navios/commander/legacy-compat'
40
- * import { z } from 'zod'
19
+ * import { z } from 'zod/v4'
41
20
  *
42
21
  * const optionsSchema = z.object({
43
22
  * name: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["createClassContext","Command","OriginalCommand","options","target","context","originalDecorator","createClassContext","CliModule","OriginalCliModule","options","commands","controllers","imports","guards","overrides","target","context","originalDecorator"],"sources":["../../../../node_modules/@navios/di/lib/legacy-compat/index.mjs","../../src/legacy-compat/decorators/command.decorator.mts","../../src/legacy-compat/decorators/cli-module.decorator.mts"],"sourcesContent":["import { t as Injectable$1 } from \"../injectable.decorator-CyPrBzBN.mjs\";\nimport { t as Factory$1 } from \"../factory.decorator-_IPWcwQn.mjs\";\n\n//#region src/legacy-compat/context-compat.mts\n/**\n* Compatibility layer for converting legacy decorator signatures to Stage 3 format.\n*\n* This module provides utilities to create mock Stage 3 decorator contexts\n* from legacy decorator arguments, and manages metadata storage using WeakMap.\n*/ const classMetadataMap = /* @__PURE__ */ new WeakMap();\n/**\n* Gets the constructor from a prototype (for method decorators).\n*/ function getConstructor(prototype) {\n\tif (!prototype || typeof prototype !== \"object\") return null;\n\tconst constructor = prototype.constructor;\n\tif (constructor && typeof constructor === \"function\") return constructor;\n\treturn null;\n}\n/**\n* Creates a mock ClassDecoratorContext for legacy class decorators.\n* @internal\n*/ function createClassContext(target) {\n\tif (!classMetadataMap.has(target)) classMetadataMap.set(target, {});\n\tconst metadata = classMetadataMap.get(target);\n\treturn {\n\t\tkind: \"class\",\n\t\tname: target.name,\n\t\tmetadata,\n\t\taddInitializer() {}\n\t};\n}\n/**\n* Creates a mock ClassMethodDecoratorContext for legacy method decorators.\n*\n* Note: Method decorators need to share metadata with the class context\n* because endpoint metadata is stored at the class level.\n* @internal\n*/ function createMethodContext(target, propertyKey, descriptor) {\n\tconst constructor = getConstructor(target);\n\tif (!constructor) throw new Error(\"[Navios] Could not determine class constructor from method decorator target.\");\n\tif (!classMetadataMap.has(constructor)) classMetadataMap.set(constructor, {});\n\treturn {\n\t\tkind: \"method\",\n\t\tname: propertyKey,\n\t\tmetadata: classMetadataMap.get(constructor),\n\t\tstatic: false,\n\t\tprivate: false,\n\t\taccess: {\n\t\t\thas: () => true,\n\t\t\tget: () => descriptor.value,\n\t\t\tset: () => {}\n\t\t},\n\t\taddInitializer() {}\n\t};\n}\n\n//#endregion\n//#region src/legacy-compat/injectable.decorator.mts\n/**\n* Legacy-compatible Injectable decorator.\n*\n* Works with TypeScript experimental decorators (legacy API).\n*\n* @param options - Injectable configuration options\n* @returns A class decorator compatible with legacy decorator API\n*\n* @example\n* ```typescript\n* @Injectable()\n* export class UserService {\n* getUser(id: string) {\n* return { id, name: 'John' }\n* }\n* }\n* ```\n*/ function Injectable(options = {}) {\n\treturn function(target) {\n\t\tconst context = createClassContext(target);\n\t\treturn (Object.keys(options).length === 0 ? Injectable$1() : Injectable$1(options))(target, context);\n\t};\n}\n\n//#endregion\n//#region src/legacy-compat/factory.decorator.mts\n/**\n* Legacy-compatible Factory decorator.\n*\n* Works with TypeScript experimental decorators (legacy API).\n*\n* @param options - Factory configuration options\n* @returns A class decorator compatible with legacy decorator API\n*\n* @example\n* ```typescript\n* @Factory()\n* export class DatabaseConnectionFactory {\n* create() {\n* return { host: 'localhost', port: 5432 }\n* }\n* }\n* ```\n*/ function Factory(options = {}) {\n\treturn function(target) {\n\t\tconst context = createClassContext(target);\n\t\treturn (Object.keys(options).length === 0 ? Factory$1() : Factory$1(options))(target, context);\n\t};\n}\n\n//#endregion\nexport { Factory, Injectable, createClassContext, createMethodContext };\n//# sourceMappingURL=index.mjs.map","import type { ClassType } from '@navios/core'\nimport { createClassContext } from '@navios/di/legacy-compat'\n\nimport {\n Command as OriginalCommand,\n type CommandOptions,\n} from '../../decorators/command.decorator.mjs'\n\nexport type { CommandOptions }\n\n/**\n * Legacy-compatible Command decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Command configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * import { Command, CommandHandler } from '@navios/commander/legacy-compat'\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 function Command(options: CommandOptions) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalCommand(options)\n return originalDecorator(target, context)\n }\n}\n","import type { ClassType } from '@navios/core'\nimport { createClassContext } from '@navios/di/legacy-compat'\n\nimport {\n CliModule as OriginalCliModule,\n type CliModuleOptions,\n} from '../../decorators/cli-module.decorator.mjs'\n\nexport type { CliModuleOptions }\n\n/**\n * Legacy-compatible CliModule decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - CLI module configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * import { CliModule } from '@navios/commander/legacy-compat'\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 */\nexport function CliModule(\n options: CliModuleOptions = {\n commands: [],\n controllers: [],\n imports: [],\n guards: [],\n overrides: [],\n },\n) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalCliModule(options)\n return originalDecorator(target, context)\n }\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;GASG,MAAM,mCAAmC,IAAI,SAAS;;;;GAYtD,SAAS,mBAAmB,QAAQ;AACtC,KAAI,CAAC,iBAAiB,IAAI,OAAO,CAAE,kBAAiB,IAAI,QAAQ,EAAE,CAAC;CACnE,MAAM,WAAW,iBAAiB,IAAI,OAAO;AAC7C,QAAO;EACN,MAAM;EACN,MAAM,OAAO;EACb;EACA,iBAAiB;EACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCUF,SAAgBC,QAAQE,SAAuB;AAC7C,QAAO,SAAUC,QAAiB;EAChC,MAAMC,UAAUL,mBAAmBI,OAAAA;AAEnC,SAD0BF,UAAgBC,QAAAA,CACjBC,QAAQC,QAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GCZrC,SAAgBG,UACdE,UAA4B;CAC1BC,UAAU,EAAE;CACZC,aAAa,EAAE;CACfC,SAAS,EAAE;CACXC,QAAQ,EAAE;CACVC,WAAW,EAAE;CACd,EAAA;AAED,QAAO,SAAUC,QAAiB;EAChC,MAAMC,UAAUV,mBAAmBS,OAAAA;AAEnC,SAD0BP,YAAkBC,QAAAA,CACnBM,QAAQC,QAAAA"}
1
+ {"version":3,"file":"index.mjs","names":["createClassContext","Command","OriginalCommand","options","target","context","originalDecorator","createClassContext","CliModule","OriginalCliModule","options","commands","controllers","imports","guards","overrides","target","context","originalDecorator"],"sources":["../../src/legacy-compat/decorators/command.decorator.mts","../../src/legacy-compat/decorators/cli-module.decorator.mts"],"sourcesContent":["import { createClassContext } from '@navios/core/legacy-compat'\n\nimport type { ClassType } from '@navios/core'\n\nimport {\n Command as OriginalCommand,\n type CommandOptions,\n} from '../../decorators/command.decorator.mjs'\n\nexport type { CommandOptions }\n\n/**\n * Legacy-compatible Command decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Command configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * import { Command, CommandHandler } from '@navios/commander/legacy-compat'\n * import { z } from 'zod/v4'\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 function Command(options: CommandOptions) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalCommand(options)\n return originalDecorator(target, context)\n }\n}\n","import { createClassContext } from '@navios/core/legacy-compat'\n\nimport type { ClassType } from '@navios/core'\n\nimport {\n CliModule as OriginalCliModule,\n type CliModuleOptions,\n} from '../../decorators/cli-module.decorator.mjs'\n\nexport type { CliModuleOptions }\n\n/**\n * Legacy-compatible CliModule decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - CLI module configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * import { CliModule } from '@navios/commander/legacy-compat'\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 */\nexport function CliModule(\n options: CliModuleOptions = {\n commands: [],\n controllers: [],\n imports: [],\n guards: [],\n overrides: [],\n },\n) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalCliModule(options)\n return originalDecorator(target, context)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCA,SAAgBC,QAAQE,SAAuB;AAC7C,QAAO,SAAUC,QAAiB;EAChC,MAAMC,UAAUL,mBAAmBI,OAAAA;AAEnC,SAD0BF,UAAgBC,QAAAA,CACjBC,QAAQC,QAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GCZrC,SAAgBG,UACdE,UAA4B;CAC1BC,UAAU,EAAE;CACZC,aAAa,EAAE;CACfC,SAAS,EAAE;CACXC,QAAQ,EAAE;CACVC,WAAW,EAAE;CACd,EAAA;AAED,QAAO,SAAUC,QAAiB;EAChC,MAAMC,UAAUV,mBAAmBS,OAAAA;AAEnC,SAD0BP,YAAkBC,QAAAA,CACnBM,QAAQC,QAAAA"}
package/package.json CHANGED
@@ -1,28 +1,19 @@
1
1
  {
2
2
  "name": "@navios/commander",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
+ "license": "MIT",
4
5
  "author": {
5
6
  "name": "Oleksandr Hanzha",
6
7
  "email": "alex@granted.name"
7
8
  },
8
9
  "repository": {
9
- "directory": "packages/commander",
10
10
  "type": "git",
11
- "url": "https://github.com/navios-org/commander.git"
12
- },
13
- "license": "MIT",
14
- "peerDependencies": {
15
- "@navios/commander-tui": "^1.0.0",
16
- "zod": "^4.0.0"
17
- },
18
- "peerDependenciesMeta": {
19
- "@navios/commander-tui": {
20
- "optional": true
21
- }
11
+ "url": "https://github.com/navios-org/commander.git",
12
+ "directory": "packages/commander"
22
13
  },
23
- "typings": "./lib/index.d.mts",
24
14
  "main": "./lib/index.cjs",
25
15
  "module": "./lib/index.mjs",
16
+ "typings": "./lib/index.d.mts",
26
17
  "exports": {
27
18
  ".": {
28
19
  "import": {
@@ -45,13 +36,32 @@
45
36
  }
46
37
  }
47
38
  },
39
+ "scripts": {
40
+ "check": "yarn run -T tsgo -b",
41
+ "lint": "yarn run -T oxlint --fix && yarn run -T oxfmt",
42
+ "test": "vitest",
43
+ "test:ci": "vitest run",
44
+ "build": "yarn run -T tsdown",
45
+ "publish:pkg": "yarn npm publish --access public",
46
+ "publish:next": "yarn npm publish --access public --tag next"
47
+ },
48
+ "dependencies": {
49
+ "@navios/core": "^1.0.0"
50
+ },
48
51
  "devDependencies": {
49
52
  "@navios/builder": "^1.0.0",
53
+ "@navios/commander-tui": "1.6.1",
50
54
  "tsx": "^4.21.0",
51
55
  "typescript": "^5.9.3",
52
56
  "zod": "^4.3.5"
53
57
  },
54
- "dependencies": {
55
- "@navios/core": "^1.0.0"
58
+ "peerDependencies": {
59
+ "@navios/commander-tui": "^1.0.0",
60
+ "zod": "^4.0.0"
61
+ },
62
+ "peerDependenciesMeta": {
63
+ "@navios/commander-tui": {
64
+ "optional": true
65
+ }
56
66
  }
57
67
  }
@@ -1,11 +1,13 @@
1
+ import { inject } from '@navios/core'
1
2
  import { beforeEach, describe, expect, it, vi } from 'vitest'
2
- import { z } from 'zod'
3
-
4
- import type { CommandHandler } from '../interfaces/command-handler.interface.mjs'
3
+ import { z } from 'zod/v4'
5
4
 
6
5
  import { CommanderFactory } from '../commander.factory.mjs'
7
6
  import { CliModule } from '../decorators/cli-module.decorator.mjs'
8
7
  import { Command } from '../decorators/command.decorator.mjs'
8
+ import { CommandExecutionContext } from '../tokens/index.mjs'
9
+
10
+ import type { CommandHandler } from '../interfaces/command-handler.interface.mjs'
9
11
 
10
12
  describe('CommanderApplication E2E - run() with different argv', () => {
11
13
  describe('simple command without options', () => {
@@ -112,9 +114,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
112
114
  })
113
115
 
114
116
  @Command({ path: 'deploy', optionsSchema })
115
- class DeployCommand implements CommandHandler<
116
- z.infer<typeof optionsSchema>
117
- > {
117
+ class DeployCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
118
118
  async execute(options: z.infer<typeof optionsSchema>) {
119
119
  executeMock(options)
120
120
  }
@@ -144,9 +144,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
144
144
  })
145
145
 
146
146
  @Command({ path: 'build', optionsSchema })
147
- class BuildCommand implements CommandHandler<
148
- z.infer<typeof optionsSchema>
149
- > {
147
+ class BuildCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
150
148
  async execute(options: z.infer<typeof optionsSchema>) {
151
149
  executeMock(options)
152
150
  }
@@ -181,9 +179,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
181
179
  })
182
180
 
183
181
  @Command({ path: 'greet', optionsSchema })
184
- class GreetCommand implements CommandHandler<
185
- z.infer<typeof optionsSchema>
186
- > {
182
+ class GreetCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
187
183
  async execute(options: z.infer<typeof optionsSchema>) {
188
184
  executeMock(options)
189
185
  }
@@ -243,13 +239,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
243
239
  await app.init()
244
240
 
245
241
  const adapter = app.getAdapter()
246
- await adapter.run([
247
- 'node',
248
- 'script.js',
249
- 'greet',
250
- '--name=Charlie',
251
- '--greeting=Hey',
252
- ])
242
+ await adapter.run(['node', 'script.js', 'greet', '--name=Charlie', '--greeting=Hey'])
253
243
 
254
244
  expect(executeMock).toHaveBeenCalledWith({
255
245
  name: 'Charlie',
@@ -293,9 +283,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
293
283
  })
294
284
 
295
285
  @Command({ path: 'serve', optionsSchema })
296
- class ServeCommand implements CommandHandler<
297
- z.infer<typeof optionsSchema>
298
- > {
286
+ class ServeCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
299
287
  async execute(options: z.infer<typeof optionsSchema>) {
300
288
  executeMock(options)
301
289
  }
@@ -378,9 +366,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
378
366
  })
379
367
 
380
368
  @Command({ path: 'start', optionsSchema })
381
- class StartCommand implements CommandHandler<
382
- z.infer<typeof optionsSchema>
383
- > {
369
+ class StartCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
384
370
  async execute(options: z.infer<typeof optionsSchema>) {
385
371
  executeMock(options)
386
372
  }
@@ -520,9 +506,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
520
506
  })
521
507
 
522
508
  @Command({ path: 'db rollback', optionsSchema })
523
- class DbRollbackWithOptionsCommand implements CommandHandler<
524
- z.infer<typeof optionsSchema>
525
- > {
509
+ class DbRollbackWithOptionsCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
526
510
  async execute(options: z.infer<typeof optionsSchema>) {
527
511
  executeMock(options)
528
512
  }
@@ -562,9 +546,9 @@ describe('CommanderApplication E2E - run() with different argv', () => {
562
546
  await app.init()
563
547
 
564
548
  const adapter = app.getAdapter()
565
- await expect(
566
- adapter.run(['node', 'script.js', 'invalid']),
567
- ).rejects.toThrow('[Navios Commander] Command not found: invalid')
549
+ await expect(adapter.run(['node', 'script.js', 'invalid'])).rejects.toThrow(
550
+ '[Navios Commander] Command not found: invalid',
551
+ )
568
552
 
569
553
  await app.close()
570
554
  })
@@ -591,44 +575,134 @@ describe('CommanderApplication E2E - run() with different argv', () => {
591
575
 
592
576
  @Command({ path: 'copy', optionsSchema })
593
577
  class CopyCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
594
- async execute(options: z.infer<typeof optionsSchema>) {
595
- executeMock(options)
578
+ async execute(options: z.infer<typeof optionsSchema>, positionals?: string[]) {
579
+ executeMock(options, positionals)
580
+ }
581
+ }
582
+
583
+ const noOptionsMock = vi.fn()
584
+
585
+ @Command({ path: 'ping' })
586
+ class PingCommand implements CommandHandler {
587
+ async execute(_options: unknown, positionals?: string[]) {
588
+ noOptionsMock(positionals)
596
589
  }
597
590
  }
598
591
 
599
592
  @CliModule({
600
- commands: [CopyCommand],
593
+ commands: [CopyCommand, PingCommand],
601
594
  })
602
595
  class TestModule {}
603
596
 
604
597
  beforeEach(() => {
605
598
  executeMock.mockClear()
599
+ noOptionsMock.mockClear()
606
600
  })
607
601
 
608
- it('should parse command with options only', async () => {
602
+ it('should pass empty positionals for command without options', async () => {
609
603
  const app = await CommanderFactory.create(TestModule)
610
604
  await app.init()
611
605
 
612
606
  const adapter = app.getAdapter()
613
- await adapter.run(['node', 'script.js', 'copy', '--force'])
607
+ await adapter.run(['node', 'script.js', 'ping'])
614
608
 
615
- expect(executeMock).toHaveBeenCalledWith({
616
- force: true,
617
- })
609
+ expect(noOptionsMock).toHaveBeenCalledWith([])
618
610
  await app.close()
619
611
  })
620
612
 
621
- it('should parse command with mixed options and positionals', async () => {
613
+ it('should parse command with options only and empty positionals', async () => {
622
614
  const app = await CommanderFactory.create(TestModule)
623
615
  await app.init()
624
616
 
625
617
  const adapter = app.getAdapter()
626
- // Note: positionals are not extracted in this test, but the command should still execute
627
618
  await adapter.run(['node', 'script.js', 'copy', '--force'])
628
619
 
629
- expect(executeMock).toHaveBeenCalledWith({
630
- force: true,
631
- })
620
+ expect(executeMock).toHaveBeenCalledWith({ force: true }, [])
621
+ await app.close()
622
+ })
623
+
624
+ it('should pass positionals as second argument to execute', async () => {
625
+ const app = await CommanderFactory.create(TestModule)
626
+ await app.init()
627
+
628
+ const adapter = app.getAdapter()
629
+ // Positionals must come after at least one option because the parser
630
+ // collects command words until it hits an argument starting with '-'
631
+ await adapter.run(['node', 'script.js', 'copy', '--force', 'source.txt', 'dest.txt'])
632
+
633
+ expect(executeMock).toHaveBeenCalledWith({ force: true }, ['source.txt', 'dest.txt'])
634
+ await app.close()
635
+ })
636
+
637
+ it('should pass multiple positionals after options', async () => {
638
+ const app = await CommanderFactory.create(TestModule)
639
+ await app.init()
640
+
641
+ const adapter = app.getAdapter()
642
+ await adapter.run([
643
+ 'node',
644
+ 'script.js',
645
+ 'copy',
646
+ '--force',
647
+ 'file1.txt',
648
+ 'file2.txt',
649
+ 'file3.txt',
650
+ ])
651
+
652
+ expect(executeMock).toHaveBeenCalledWith({ force: true }, [
653
+ 'file1.txt',
654
+ 'file2.txt',
655
+ 'file3.txt',
656
+ ])
657
+ await app.close()
658
+ })
659
+ })
660
+
661
+ describe('positionals via execution context', () => {
662
+ const contextMock = vi.fn()
663
+
664
+ const processSchema = z.object({
665
+ verbose: z.boolean().optional().default(false),
666
+ })
667
+
668
+ @Command({ path: 'process', optionsSchema: processSchema })
669
+ class ProcessCommand implements CommandHandler<z.infer<typeof processSchema>> {
670
+ private ctx = inject(CommandExecutionContext)
671
+
672
+ async execute() {
673
+ contextMock(this.ctx.getPositionals())
674
+ }
675
+ }
676
+
677
+ @CliModule({
678
+ commands: [ProcessCommand],
679
+ })
680
+ class ContextTestModule {}
681
+
682
+ beforeEach(() => {
683
+ contextMock.mockClear()
684
+ })
685
+
686
+ it('should access positionals via CommandExecutionContext', async () => {
687
+ const app = await CommanderFactory.create(ContextTestModule)
688
+ await app.init()
689
+
690
+ const adapter = app.getAdapter()
691
+ // Positionals must come after at least one option
692
+ await adapter.run(['node', 'script.js', 'process', '--verbose', 'file1.txt', 'file2.txt'])
693
+
694
+ expect(contextMock).toHaveBeenCalledWith(['file1.txt', 'file2.txt'])
695
+ await app.close()
696
+ })
697
+
698
+ it('should return empty array when no positionals via context', async () => {
699
+ const app = await CommanderFactory.create(ContextTestModule)
700
+ await app.init()
701
+
702
+ const adapter = app.getAdapter()
703
+ await adapter.run(['node', 'script.js', 'process', '--verbose'])
704
+
705
+ expect(contextMock).toHaveBeenCalledWith([])
632
706
  await app.close()
633
707
  })
634
708
  })
@@ -648,9 +722,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
648
722
  })
649
723
 
650
724
  @Command({ path: 'app deploy', optionsSchema: deploySchema })
651
- class DeployCommand implements CommandHandler<
652
- z.infer<typeof deploySchema>
653
- > {
725
+ class DeployCommand implements CommandHandler<z.infer<typeof deploySchema>> {
654
726
  async execute(options: z.infer<typeof deploySchema>) {
655
727
  executeMock(options)
656
728
  }
@@ -768,9 +840,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
768
840
  })
769
841
 
770
842
  @Command({ path: 'process', optionsSchema })
771
- class ProcessCommand implements CommandHandler<
772
- z.infer<typeof optionsSchema>
773
- > {
843
+ class ProcessCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
774
844
  async execute(options: z.infer<typeof optionsSchema>) {
775
845
  executeMock(options)
776
846
  }
@@ -790,13 +860,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
790
860
  await app.init()
791
861
 
792
862
  const adapter = app.getAdapter()
793
- await adapter.run([
794
- 'node',
795
- 'script.js',
796
- 'process',
797
- '--path',
798
- '/usr/local/bin',
799
- ])
863
+ await adapter.run(['node', 'script.js', 'process', '--path', '/usr/local/bin'])
800
864
 
801
865
  expect(executeMock).toHaveBeenCalledWith({
802
866
  path: '/usr/local/bin',
@@ -835,9 +899,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
835
899
  })
836
900
 
837
901
  @Command({ path: 'json-process', optionsSchema: jsonSchema })
838
- class JsonProcessCommand implements CommandHandler<
839
- z.infer<typeof jsonSchema>
840
- > {
902
+ class JsonProcessCommand implements CommandHandler<z.infer<typeof jsonSchema>> {
841
903
  async execute(options: z.infer<typeof jsonSchema>) {
842
904
  executeMock(options)
843
905
  }
@@ -902,9 +964,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
902
964
  })
903
965
 
904
966
  @Command({ path: 'welcome', optionsSchema })
905
- class WelcomeCommand implements CommandHandler<
906
- z.infer<typeof optionsSchema>
907
- > {
967
+ class WelcomeCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
908
968
  async execute(options: z.infer<typeof optionsSchema>) {
909
969
  executeMock(options)
910
970
  }
@@ -971,15 +1031,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
971
1031
  await app.init()
972
1032
 
973
1033
  const adapter = app.getAdapter()
974
- await adapter.run([
975
- 'node',
976
- 'script.js',
977
- 'welcome',
978
- '--name',
979
- 'Charlie',
980
- '--count',
981
- '3',
982
- ])
1034
+ await adapter.run(['node', 'script.js', 'welcome', '--name', 'Charlie', '--count', '3'])
983
1035
 
984
1036
  expect(executeMock).toHaveBeenCalledWith({
985
1037
  name: 'Charlie',
@@ -1076,16 +1128,14 @@ describe('CommanderApplication E2E - run() with different argv', () => {
1076
1128
  await app.close()
1077
1129
  })
1078
1130
 
1079
- it('should validate options with Zod schema', async () => {
1131
+ it('should validate options with zod/v4 schema', async () => {
1080
1132
  const optionsSchema = z.object({
1081
1133
  name: z.string().min(1),
1082
1134
  email: z.string().email(),
1083
1135
  })
1084
1136
 
1085
1137
  @Command({ path: 'create-user', optionsSchema })
1086
- class CreateUserCommand implements CommandHandler<
1087
- z.infer<typeof optionsSchema>
1088
- > {
1138
+ class CreateUserCommand implements CommandHandler<z.infer<typeof optionsSchema>> {
1089
1139
  async execute(options: z.infer<typeof optionsSchema>) {
1090
1140
  executeMock(options)
1091
1141
  }
@@ -1145,9 +1195,7 @@ describe('CommanderApplication E2E - run() with different argv', () => {
1145
1195
 
1146
1196
  // 3 commands: cmd1, cmd2, and the built-in help command
1147
1197
  expect(commands).toHaveLength(3)
1148
- expect(commands.map((c) => c.path)).toEqual(
1149
- expect.arrayContaining(['cmd1', 'cmd2', 'help']),
1150
- )
1198
+ expect(commands.map((c) => c.path)).toEqual(expect.arrayContaining(['cmd1', 'cmd2', 'help']))
1151
1199
 
1152
1200
  await app.close()
1153
1201
  })
@@ -1,5 +1,5 @@
1
1
  import { inject, Logger } from '@navios/core'
2
- import { z } from 'zod'
2
+ import { z } from 'zod/v4'
3
3
 
4
4
  import { Command } from '../decorators/command.decorator.mjs'
5
5
  import { CommandRegistryService } from '../services/command-registry.service.mjs'
@@ -1,11 +1,8 @@
1
- import type { ClassType, Registry } from '@navios/core'
2
-
3
1
  import { Module, getModuleMetadata, getModuleCustomEntry } from '@navios/core'
4
2
 
5
- import {
6
- CommandEntryKey,
7
- type CommandEntryValue,
8
- } from '../metadata/command-entry.metadata.mjs'
3
+ import type { ClassType, Registry } from '@navios/core'
4
+
5
+ import { CommandEntryKey, type CommandEntryValue } from '../metadata/command-entry.metadata.mjs'
9
6
 
10
7
  /**
11
8
  * Options for the `@CliModule` decorator.
@@ -108,9 +105,7 @@ export function CliModule(
108
105
  ) {
109
106
  return (target: ClassType, context: ClassDecoratorContext) => {
110
107
  if (context.kind !== 'class') {
111
- throw new Error(
112
- '[Navios Commander] @CliModule decorator can only be used on classes.',
113
- )
108
+ throw new Error('[Navios Commander] @CliModule decorator can only be used on classes.')
114
109
  }
115
110
 
116
111
  // Apply standard @Module decorator first
@@ -1,7 +1,7 @@
1
1
  import { Injectable, InjectableScope, InjectionToken } from '@navios/core'
2
2
 
3
3
  import type { ClassType, ClassTypeWithInstance, Registry } from '@navios/core'
4
- import type { ZodObject } from 'zod'
4
+ import type { z } from 'zod/v4'
5
5
 
6
6
  import { getCommandMetadata } from '../metadata/index.mjs'
7
7
 
@@ -29,10 +29,10 @@ export interface CommandOptions {
29
29
  */
30
30
  description?: string
31
31
  /**
32
- * Optional Zod schema for validating command options.
32
+ * Optional zod/v4 schema for validating command options.
33
33
  * If provided, options will be validated and parsed according to this schema.
34
34
  */
35
- optionsSchema?: ZodObject
35
+ optionsSchema?: z.ZodObject
36
36
  /**
37
37
  * Priority level for the command.
38
38
  * Higher priority commands will be loaded first.
@@ -57,7 +57,7 @@ export interface CommandOptions {
57
57
  * @example
58
58
  * ```typescript
59
59
  * import { Command, CommandHandler } from '@navios/commander'
60
- * import { z } from 'zod'
60
+ * import { z } from 'zod/v4'
61
61
  *
62
62
  * const optionsSchema = z.object({
63
63
  * name: z.string(),
@@ -1,10 +1,10 @@
1
- import type { AnyInjectableType, InjectionToken } from '@navios/core'
2
-
3
1
  import { AdapterToken } from '@navios/core'
4
2
 
5
- import { CommanderAdapterService } from './services/commander-adapter.service.mjs'
6
- import { CommandRegistryService } from './services/command-registry.service.mjs'
3
+ import type { AnyInjectableType, InjectionToken } from '@navios/core'
4
+
7
5
  import { CliParserService } from './services/cli-parser.service.mjs'
6
+ import { CommandRegistryService } from './services/command-registry.service.mjs'
7
+ import { CommanderAdapterService } from './services/commander-adapter.service.mjs'
8
8
 
9
9
  /**
10
10
  * Defines the CLI environment configuration for use with NaviosFactory.