@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.
- package/.turbo/turbo-build.log +48 -0
- package/.turbo/turbo-check.log +0 -0
- package/.turbo/turbo-lint.log +2 -0
- package/.turbo/turbo-test$colon$ci.log +109 -0
- package/.turbo/turbo-test.log +107 -0
- package/CHANGELOG.md +15 -3
- package/README.md +8 -16
- package/dist/src/commander.factory.d.mts +126 -122
- package/dist/src/commander.factory.d.mts.map +1 -1
- package/dist/src/commands/help.command.d.mts +15 -11
- package/dist/src/commands/help.command.d.mts.map +1 -1
- package/dist/src/commands/index.d.mts +2 -2
- package/dist/src/decorators/cli-module.decorator.d.mts +51 -40
- package/dist/src/decorators/cli-module.decorator.d.mts.map +1 -1
- package/dist/src/decorators/command.decorator.d.mts +49 -37
- package/dist/src/decorators/command.decorator.d.mts.map +1 -1
- package/dist/src/decorators/index.d.mts +3 -3
- package/dist/src/define-environment.d.mts +9 -8
- package/dist/src/define-environment.d.mts.map +1 -1
- package/dist/src/index.d.mts +10 -10
- package/dist/src/interfaces/abstract-cli-adapter.interface.d.mts +45 -45
- package/dist/src/interfaces/command-handler.interface.d.mts +14 -10
- package/dist/src/interfaces/command-handler.interface.d.mts.map +1 -1
- package/dist/src/interfaces/commander-execution-context.interface.d.mts +40 -30
- package/dist/src/interfaces/commander-execution-context.interface.d.mts.map +1 -1
- package/dist/src/interfaces/environment.interface.d.mts +7 -7
- package/dist/src/interfaces/index.d.mts +5 -5
- package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts +6 -5
- package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts.map +1 -1
- package/dist/src/legacy-compat/decorators/command.decorator.d.mts +7 -6
- package/dist/src/legacy-compat/decorators/command.decorator.d.mts.map +1 -1
- package/dist/src/legacy-compat/decorators/index.d.mts +3 -3
- package/dist/src/legacy-compat/index.d.mts +3 -3
- package/dist/src/metadata/command-entry.metadata.d.mts +5 -5
- package/dist/src/metadata/command-entry.metadata.d.mts.map +1 -1
- package/dist/src/metadata/command.metadata.d.mts +30 -24
- package/dist/src/metadata/command.metadata.d.mts.map +1 -1
- package/dist/src/metadata/index.d.mts +3 -3
- package/dist/src/overrides/help.command.d.mts +15 -11
- package/dist/src/overrides/help.command.d.mts.map +1 -1
- package/dist/src/services/cli-parser.service.d.mts +54 -54
- package/dist/src/services/cli-parser.service.d.mts.map +1 -1
- package/dist/src/services/command-registry.service.d.mts +75 -74
- package/dist/src/services/command-registry.service.d.mts.map +1 -1
- package/dist/src/services/commander-adapter.service.d.mts +53 -48
- package/dist/src/services/commander-adapter.service.d.mts.map +1 -1
- package/dist/src/services/index.d.mts +4 -4
- package/dist/src/tokens/execution-context.token.d.mts +9 -4
- package/dist/src/tokens/execution-context.token.d.mts.map +1 -1
- package/dist/src/tokens/help-command.token.d.mts +5 -4
- package/dist/src/tokens/index.d.mts +2 -2
- package/dist/src/utils/index.d.mts +2 -2
- package/dist/src/utils/runtime.d.mts +2 -2
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tsdown.config.d.mts +3 -3
- package/dist/vitest.config.d.mts +3 -3
- package/lib/{cli-module.decorator-CRaNGvgl.d.cts → cli-module.decorator-BV3vVKlR.d.cts} +60 -55
- package/lib/cli-module.decorator-BV3vVKlR.d.cts.map +1 -0
- package/lib/{cli-module.decorator-CkP22084.cjs → cli-module.decorator-CXt38aqF.cjs} +2 -2
- package/lib/cli-module.decorator-CXt38aqF.cjs.map +1 -0
- package/lib/{cli-module.decorator-UGbtkRYc.mjs → cli-module.decorator-DAjf_r_W.mjs} +2 -2
- package/lib/cli-module.decorator-DAjf_r_W.mjs.map +1 -0
- package/lib/{cli-module.decorator-bsP5gEn7.d.mts → cli-module.decorator-DDlgpTgI.d.mts} +133 -118
- package/lib/cli-module.decorator-DDlgpTgI.d.mts.map +1 -0
- package/lib/{command.decorator-UrNJmQN0.cjs → command.decorator-HziankUv.cjs} +3 -3
- package/lib/command.decorator-HziankUv.cjs.map +1 -0
- package/lib/{command.decorator-DVLSAqYZ.mjs → command.decorator-QiRU7ny3.mjs} +3 -3
- package/lib/command.decorator-QiRU7ny3.mjs.map +1 -0
- package/lib/{help-command.token-CMWYI6em.cjs → help-command.token-DamE31Aw.cjs} +4 -4
- package/lib/{help-command.token-CMWYI6em.cjs.map → help-command.token-DamE31Aw.cjs.map} +1 -1
- package/lib/{help-command.token-C0Kgj60o.mjs → help-command.token-XHx3WkoD.mjs} +4 -4
- package/lib/{help-command.token-C0Kgj60o.mjs.map → help-command.token-XHx3WkoD.mjs.map} +1 -1
- package/lib/{help.command-dtZbhq0w.mjs → help.command-Bynoll_7.mjs} +5 -8
- package/lib/help.command-Bynoll_7.mjs.map +1 -0
- package/lib/{help.command-DQyv6ali.cjs → help.command-DvKmMpB7.cjs} +6 -9
- package/lib/help.command-DvKmMpB7.cjs.map +1 -0
- package/lib/index.cjs +118 -106
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +294 -284
- package/lib/index.d.cts.map +1 -1
- package/lib/index.d.mts +221 -221
- package/lib/index.d.mts.map +1 -1
- package/lib/index.mjs +117 -105
- package/lib/index.mjs.map +1 -1
- package/lib/legacy-compat/index.cjs +6 -28
- package/lib/legacy-compat/index.cjs.map +1 -1
- package/lib/legacy-compat/index.d.cts +3 -2
- package/lib/legacy-compat/index.d.cts.map +1 -1
- package/lib/legacy-compat/index.d.mts +3 -2
- package/lib/legacy-compat/index.d.mts.map +1 -1
- package/lib/legacy-compat/index.mjs +4 -25
- package/lib/legacy-compat/index.mjs.map +1 -1
- package/package.json +26 -16
- package/src/__tests__/commander.factory.e2e.spec.mts +127 -79
- package/src/commands/help.command.mts +1 -1
- package/src/decorators/cli-module.decorator.mts +4 -9
- package/src/decorators/command.decorator.mts +4 -4
- package/src/define-environment.mts +4 -4
- package/src/interfaces/command-handler.interface.mts +8 -4
- package/src/interfaces/commander-execution-context.interface.mts +14 -1
- package/src/legacy-compat/decorators/cli-module.decorator.mts +2 -1
- package/src/legacy-compat/decorators/command.decorator.mts +3 -2
- package/src/metadata/command-entry.metadata.mts +3 -6
- package/src/metadata/command.metadata.mts +6 -8
- package/src/overrides/help.command.mts +2 -2
- package/src/services/__tests__/cli-parser.service.spec.mts +23 -178
- package/src/services/cli-parser.service.mts +23 -27
- package/src/services/command-registry.service.mts +5 -5
- package/src/services/commander-adapter.service.mts +12 -20
- package/src/tokens/execution-context.token.mts +4 -6
- package/tsconfig.json +3 -0
- package/lib/cli-module.decorator-CRaNGvgl.d.cts.map +0 -1
- package/lib/cli-module.decorator-CkP22084.cjs.map +0 -1
- package/lib/cli-module.decorator-UGbtkRYc.mjs.map +0 -1
- package/lib/cli-module.decorator-bsP5gEn7.d.mts.map +0 -1
- package/lib/command.decorator-DVLSAqYZ.mjs.map +0 -1
- package/lib/command.decorator-UrNJmQN0.cjs.map +0 -1
- package/lib/help.command-DQyv6ali.cjs.map +0 -1
- package/lib/help.command-dtZbhq0w.mjs.map +0 -1
- package/project.json +0 -66
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbstractAdapterInterface } from '@navios/core'
|
|
1
|
+
import type { AbstractAdapterInterface } from '@navios/core'
|
|
2
2
|
/**
|
|
3
3
|
* Interface for CLI adapters.
|
|
4
4
|
* Extends the base adapter interface with CLI-specific methods.
|
|
@@ -6,48 +6,48 @@ import type { AbstractAdapterInterface } from '@navios/core';
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export interface AbstractCliAdapterInterface extends AbstractAdapterInterface {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Run the CLI application with the given arguments.
|
|
11
|
+
* Parses arguments and executes the matching command.
|
|
12
|
+
*
|
|
13
|
+
* @param argv - Command-line arguments array (defaults to `process.argv`)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const adapter = app.getAdapter() as AbstractCliAdapterInterface
|
|
18
|
+
* await adapter.run(process.argv)
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
run(argv?: string[]): Promise<void>
|
|
22
|
+
/**
|
|
23
|
+
* Execute a command programmatically with the provided options.
|
|
24
|
+
*
|
|
25
|
+
* @param path - The command path (e.g., 'greet', 'user:create')
|
|
26
|
+
* @param options - The command options object
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* await adapter.executeCommand('user:create', {
|
|
31
|
+
* name: 'John',
|
|
32
|
+
* email: 'john@example.com',
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
executeCommand(path: string, options: Record<string, unknown>): Promise<void>
|
|
37
|
+
/**
|
|
38
|
+
* Get all registered command paths and their class references.
|
|
39
|
+
*
|
|
40
|
+
* @returns Array of objects containing path and class
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const commands = adapter.getAllCommands()
|
|
45
|
+
* commands.forEach(({ path }) => console.log(path))
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
getAllCommands(): Array<{
|
|
49
|
+
path: string
|
|
50
|
+
class: unknown
|
|
51
|
+
}>
|
|
52
52
|
}
|
|
53
|
-
//# sourceMappingURL=abstract-cli-adapter.interface.d.mts.map
|
|
53
|
+
//# sourceMappingURL=abstract-cli-adapter.interface.d.mts.map
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @example
|
|
10
10
|
* ```typescript
|
|
11
11
|
* import { Command, CommandHandler } from '@navios/commander'
|
|
12
|
-
* import { z } from 'zod'
|
|
12
|
+
* import { z } from 'zod/v4'
|
|
13
13
|
*
|
|
14
14
|
* const optionsSchema = z.object({
|
|
15
15
|
* name: z.string()
|
|
@@ -19,19 +19,23 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @Command({ path: 'greet', optionsSchema })
|
|
21
21
|
* export class GreetCommand implements CommandHandler<Options> {
|
|
22
|
-
* async execute(options: Options) {
|
|
22
|
+
* async execute(options: Options, positionals?: string[]) {
|
|
23
23
|
* console.log(`Hello, ${options.name}!`)
|
|
24
|
+
* if (positionals?.length) {
|
|
25
|
+
* console.log(`Files: ${positionals.join(', ')}`)
|
|
26
|
+
* }
|
|
24
27
|
* }
|
|
25
28
|
* }
|
|
26
29
|
* ```
|
|
27
30
|
*/
|
|
28
31
|
export interface CommandHandler<TOptions = any> {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Executes the command with the provided options and positional arguments.
|
|
34
|
+
*
|
|
35
|
+
* @param options - The validated command options (validated against the command's schema if provided)
|
|
36
|
+
* @param positionals - Positional arguments that don't match any option flags
|
|
37
|
+
* @returns A promise or void
|
|
38
|
+
*/
|
|
39
|
+
execute(options: TOptions, positionals?: string[]): void | Promise<void>
|
|
36
40
|
}
|
|
37
|
-
//# sourceMappingURL=command-handler.interface.d.mts.map
|
|
41
|
+
//# sourceMappingURL=command-handler.interface.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-handler.interface.d.mts","sourceRoot":"","sources":["../../../src/interfaces/command-handler.interface.mts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"command-handler.interface.d.mts","sourceRoot":"","sources":["../../../src/interfaces/command-handler.interface.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,cAAc,CAAC,QAAQ,GAAG,GAAG;IAC5C;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACzE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CommandMetadata } from '../metadata/command.metadata.mjs'
|
|
1
|
+
import type { CommandMetadata } from '../metadata/command.metadata.mjs'
|
|
2
2
|
/**
|
|
3
3
|
* Execution context for a command execution.
|
|
4
4
|
*
|
|
@@ -22,33 +22,43 @@ import type { CommandMetadata } from '../metadata/command.metadata.mjs';
|
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
export declare class CommanderExecutionContext {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
25
|
+
private readonly command
|
|
26
|
+
private readonly commandPath
|
|
27
|
+
private readonly options
|
|
28
|
+
private readonly positionals
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
* Creates a new execution context.
|
|
32
|
+
*/
|
|
33
|
+
constructor(command: CommandMetadata, commandPath: string, options: any, positionals?: string[])
|
|
34
|
+
/**
|
|
35
|
+
* Gets the command metadata.
|
|
36
|
+
*
|
|
37
|
+
* @returns The command metadata including path and options schema
|
|
38
|
+
*/
|
|
39
|
+
getCommand(): CommandMetadata
|
|
40
|
+
/**
|
|
41
|
+
* Gets the command path that was invoked.
|
|
42
|
+
*
|
|
43
|
+
* @returns The command path (e.g., 'greet', 'user:create')
|
|
44
|
+
*/
|
|
45
|
+
getCommandPath(): string
|
|
46
|
+
/**
|
|
47
|
+
* Gets the validated command options.
|
|
48
|
+
*
|
|
49
|
+
* Options are validated against the command's zod/v4 schema if one was provided.
|
|
50
|
+
*
|
|
51
|
+
* @returns The validated options object
|
|
52
|
+
*/
|
|
53
|
+
getOptions(): any
|
|
54
|
+
/**
|
|
55
|
+
* Gets the positional arguments.
|
|
56
|
+
*
|
|
57
|
+
* Positional arguments are values that don't match any option flags.
|
|
58
|
+
* For example, in `copy --force source.txt dest.txt`, the positionals are `['source.txt', 'dest.txt']`.
|
|
59
|
+
*
|
|
60
|
+
* @returns The positional arguments array
|
|
61
|
+
*/
|
|
62
|
+
getPositionals(): string[]
|
|
53
63
|
}
|
|
54
|
-
//# sourceMappingURL=commander-execution-context.interface.d.mts.map
|
|
64
|
+
//# sourceMappingURL=commander-execution-context.interface.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commander-execution-context.interface.d.mts","sourceRoot":"","sources":["../../../src/interfaces/commander-execution-context.interface.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,yBAAyB;IAMlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"commander-execution-context.interface.d.mts","sourceRoot":"","sources":["../../../src/interfaces/commander-execution-context.interface.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,yBAAyB;IAMlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAR9B;;;OAGG;IACH,YACmB,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,GAAG,EACZ,WAAW,GAAE,MAAM,EAAO,EACzC;IAEJ;;;;OAIG;IACH,UAAU,IAAI,eAAe,CAE5B;IAED;;;;OAIG;IACH,cAAc,IAAI,MAAM,CAEvB;IAED;;;;;;OAMG;IACH,UAAU,IAAI,GAAG,CAEhB;IAED;;;;;;;OAOG;IACH,cAAc,IAAI,MAAM,EAAE,CAEzB;CACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { AdapterEnvironment } from '@navios/core'
|
|
2
|
-
|
|
1
|
+
import type { AdapterEnvironment } from '@navios/core'
|
|
2
|
+
|
|
3
|
+
import type { AbstractCliAdapterInterface } from './abstract-cli-adapter.interface.mjs'
|
|
3
4
|
/**
|
|
4
5
|
* Options for configuring the CLI adapter.
|
|
5
6
|
*
|
|
6
7
|
* @public
|
|
7
8
|
*/
|
|
8
|
-
export interface CliAdapterOptions {
|
|
9
|
-
}
|
|
9
|
+
export interface CliAdapterOptions {}
|
|
10
10
|
/**
|
|
11
11
|
* Environment type definition for CLI adapters.
|
|
12
12
|
* Used with NaviosFactory.create<CliEnvironment>() for type-safe CLI applications.
|
|
@@ -24,7 +24,7 @@ export interface CliAdapterOptions {
|
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
export interface CliEnvironment extends AdapterEnvironment {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
options: CliAdapterOptions
|
|
28
|
+
adapter: AbstractCliAdapterInterface
|
|
29
29
|
}
|
|
30
|
-
//# sourceMappingURL=environment.interface.d.mts.map
|
|
30
|
+
//# sourceMappingURL=environment.interface.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './command-handler.interface.mjs'
|
|
2
|
-
export * from './commander-execution-context.interface.mjs'
|
|
3
|
-
export * from './abstract-cli-adapter.interface.mjs'
|
|
4
|
-
export * from './environment.interface.mjs'
|
|
5
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
export * from './command-handler.interface.mjs'
|
|
2
|
+
export * from './commander-execution-context.interface.mjs'
|
|
3
|
+
export * from './abstract-cli-adapter.interface.mjs'
|
|
4
|
+
export * from './environment.interface.mjs'
|
|
5
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ClassType } from '@navios/core'
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { ClassType } from '@navios/core'
|
|
2
|
+
|
|
3
|
+
import { type CliModuleOptions } from '../../decorators/cli-module.decorator.mjs'
|
|
4
|
+
export type { CliModuleOptions }
|
|
4
5
|
/**
|
|
5
6
|
* Legacy-compatible CliModule decorator.
|
|
6
7
|
*
|
|
@@ -22,5 +23,5 @@ export type { CliModuleOptions };
|
|
|
22
23
|
* export class AppModule {}
|
|
23
24
|
* ```
|
|
24
25
|
*/
|
|
25
|
-
export declare function CliModule(options?: CliModuleOptions): (target: ClassType) => ClassType
|
|
26
|
-
//# sourceMappingURL=cli-module.decorator.d.mts.map
|
|
26
|
+
export declare function CliModule(options?: CliModuleOptions): (target: ClassType) => ClassType
|
|
27
|
+
//# sourceMappingURL=cli-module.decorator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-module.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/cli-module.decorator.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-module.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/cli-module.decorator.mts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,2CAA2C,CAAA;AAElD,YAAY,EAAE,gBAAgB,EAAE,CAAA;AAEhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CACvB,OAAO,GAAE,gBAMR,oCAOF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ClassType } from '@navios/core'
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { ClassType } from '@navios/core'
|
|
2
|
+
|
|
3
|
+
import { type CommandOptions } from '../../decorators/command.decorator.mjs'
|
|
4
|
+
export type { CommandOptions }
|
|
4
5
|
/**
|
|
5
6
|
* Legacy-compatible Command decorator.
|
|
6
7
|
*
|
|
@@ -12,7 +13,7 @@ export type { CommandOptions };
|
|
|
12
13
|
* @example
|
|
13
14
|
* ```typescript
|
|
14
15
|
* import { Command, CommandHandler } from '@navios/commander/legacy-compat'
|
|
15
|
-
* import { z } from 'zod'
|
|
16
|
+
* import { z } from 'zod/v4'
|
|
16
17
|
*
|
|
17
18
|
* const optionsSchema = z.object({
|
|
18
19
|
* name: z.string(),
|
|
@@ -30,5 +31,5 @@ export type { CommandOptions };
|
|
|
30
31
|
* }
|
|
31
32
|
* ```
|
|
32
33
|
*/
|
|
33
|
-
export declare function Command(options: CommandOptions): (target: ClassType) => any
|
|
34
|
-
//# sourceMappingURL=command.decorator.d.mts.map
|
|
34
|
+
export declare function Command(options: CommandOptions): (target: ClassType) => any
|
|
35
|
+
//# sourceMappingURL=command.decorator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/command.decorator.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/command.decorator.mts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,wCAAwC,CAAA;AAE/C,YAAY,EAAE,cAAc,EAAE,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,8BAM9C"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './command.decorator.mjs'
|
|
2
|
-
export * from './cli-module.decorator.mjs'
|
|
3
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
export * from './command.decorator.mjs'
|
|
2
|
+
export * from './cli-module.decorator.mjs'
|
|
3
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
*
|
|
24
24
|
* @packageDocumentation
|
|
25
25
|
*/
|
|
26
|
-
export * from './decorators/index.mjs'
|
|
27
|
-
export * from '@navios/core/legacy-compat'
|
|
28
|
-
//# sourceMappingURL=index.d.mts.map
|
|
26
|
+
export * from './decorators/index.mjs'
|
|
27
|
+
export * from '@navios/core/legacy-compat'
|
|
28
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { ClassType } from '@navios/core'
|
|
1
|
+
import type { ClassType } from '@navios/core'
|
|
2
2
|
/**
|
|
3
3
|
* Symbol key for storing commands in ModuleMetadata.customEntries.
|
|
4
4
|
* Used by @CliModule to store command classes.
|
|
5
5
|
*
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
|
-
export declare const CommandEntryKey: unique symbol
|
|
8
|
+
export declare const CommandEntryKey: unique symbol
|
|
9
9
|
/**
|
|
10
10
|
* Type for the command entry value stored in customEntries.
|
|
11
11
|
*
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
|
-
export type CommandEntryValue = Set<ClassType
|
|
14
|
+
export type CommandEntryValue = Set<ClassType>
|
|
15
15
|
/**
|
|
16
16
|
* Extracts commands from a module's metadata.
|
|
17
17
|
* Returns empty set if no commands are defined.
|
|
@@ -27,5 +27,5 @@ export type CommandEntryValue = Set<ClassType>;
|
|
|
27
27
|
* }
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export declare function extractModuleCommands(moduleClass: ClassType): Set<ClassType
|
|
31
|
-
//# sourceMappingURL=command-entry.metadata.d.mts.map
|
|
30
|
+
export declare function extractModuleCommands(moduleClass: ClassType): Set<ClassType>
|
|
31
|
+
//# sourceMappingURL=command-entry.metadata.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.metadata.d.mts","sourceRoot":"","sources":["../../../src/metadata/command-entry.metadata.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-entry.metadata.d.mts","sourceRoot":"","sources":["../../../src/metadata/command-entry.metadata.mts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,eAA4B,CAAA;AAExD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;AAE9C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,CAG5E"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import type { ClassType } from '@navios/core'
|
|
2
|
-
import type {
|
|
1
|
+
import type { ClassType } from '@navios/core'
|
|
2
|
+
import type { z } from 'zod/v4'
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
* Symbol key used to store command metadata on classes.
|
|
6
6
|
*/
|
|
7
|
-
export declare const CommandMetadataKey: unique symbol
|
|
7
|
+
export declare const CommandMetadataKey: unique symbol
|
|
8
8
|
/**
|
|
9
9
|
* Metadata associated with a command.
|
|
10
10
|
*
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
13
|
export interface CommandMetadata {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The command path (e.g., 'greet', 'user:create').
|
|
16
|
+
*/
|
|
17
|
+
path: string
|
|
18
|
+
/**
|
|
19
|
+
* Optional description of the command for help text.
|
|
20
|
+
*/
|
|
21
|
+
description?: string
|
|
22
|
+
/**
|
|
23
|
+
* Optional zod/v4 schema for validating command options.
|
|
24
|
+
*/
|
|
25
|
+
optionsSchema?: z.ZodObject
|
|
26
|
+
/**
|
|
27
|
+
* Map of custom attributes that can be attached to the command.
|
|
28
|
+
*/
|
|
29
|
+
customAttributes: Map<string | symbol, any>
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Gets or creates command metadata for a class.
|
|
@@ -36,10 +36,16 @@ export interface CommandMetadata {
|
|
|
36
36
|
* @param context - The decorator context
|
|
37
37
|
* @param path - The command path
|
|
38
38
|
* @param description - Optional description for help text
|
|
39
|
-
* @param optionsSchema - Optional
|
|
39
|
+
* @param optionsSchema - Optional zod/v4 schema
|
|
40
40
|
* @returns The command metadata
|
|
41
41
|
*/
|
|
42
|
-
export declare function getCommandMetadata(
|
|
42
|
+
export declare function getCommandMetadata(
|
|
43
|
+
target: ClassType,
|
|
44
|
+
context: ClassDecoratorContext,
|
|
45
|
+
path: string,
|
|
46
|
+
description?: string,
|
|
47
|
+
optionsSchema?: z.ZodObject,
|
|
48
|
+
): CommandMetadata
|
|
43
49
|
/**
|
|
44
50
|
* Extracts command metadata from a class.
|
|
45
51
|
*
|
|
@@ -53,12 +59,12 @@ export declare function getCommandMetadata(target: ClassType, context: ClassDeco
|
|
|
53
59
|
* console.log(metadata.path) // 'greet'
|
|
54
60
|
* ```
|
|
55
61
|
*/
|
|
56
|
-
export declare function extractCommandMetadata(target: ClassType): CommandMetadata
|
|
62
|
+
export declare function extractCommandMetadata(target: ClassType): CommandMetadata
|
|
57
63
|
/**
|
|
58
64
|
* Checks if a class has command metadata.
|
|
59
65
|
*
|
|
60
66
|
* @param target - The class to check
|
|
61
67
|
* @returns `true` if the class is decorated with @Command, `false` otherwise
|
|
62
68
|
*/
|
|
63
|
-
export declare function hasCommandMetadata(target: ClassType): boolean
|
|
64
|
-
//# sourceMappingURL=command.metadata.d.mts.map
|
|
69
|
+
export declare function hasCommandMetadata(target: ClassType): boolean
|
|
70
|
+
//# sourceMappingURL=command.metadata.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.metadata.d.mts","sourceRoot":"","sources":["../../../src/metadata/command.metadata.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"command.metadata.d.mts","sourceRoot":"","sources":["../../../src/metadata/command.metadata.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;GAGG;AACH,eAAO,MAAM,kBAAkB,eAA+B,CAAA;AAE9D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,CAAC,SAAS,CAAA;IAC3B;;OAEG;IACH,gBAAgB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,CAAC,CAAC,SAAS,GAC1B,eAAe,CAmBjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,eAAe,CASzE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAI7D"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './command.metadata.mjs'
|
|
2
|
-
export * from './command-entry.metadata.mjs'
|
|
3
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
export * from './command.metadata.mjs'
|
|
2
|
+
export * from './command-entry.metadata.mjs'
|
|
3
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { z } from 'zod/v4'
|
|
2
|
+
|
|
3
|
+
import type { CommandHandler } from '../interfaces/command-handler.interface.mjs'
|
|
4
|
+
declare const helpOptionsSchema: z.ZodObject<
|
|
5
|
+
{
|
|
6
|
+
command: z.ZodOptional<z.ZodString>
|
|
7
|
+
},
|
|
8
|
+
z.core.$strip
|
|
9
|
+
>
|
|
10
|
+
type HelpOptions = z.infer<typeof helpOptionsSchema>
|
|
7
11
|
/**
|
|
8
12
|
* Built-in help command that lists all available commands or shows help for a specific command.
|
|
9
13
|
*
|
|
10
14
|
* @public
|
|
11
15
|
*/
|
|
12
16
|
export declare class HelpCommand implements CommandHandler<HelpOptions> {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
private logger
|
|
18
|
+
private commandRegistry
|
|
19
|
+
execute(options: HelpOptions): Promise<void>
|
|
16
20
|
}
|
|
17
|
-
export {}
|
|
18
|
-
//# sourceMappingURL=help.command.d.mts.map
|
|
21
|
+
export {}
|
|
22
|
+
//# sourceMappingURL=help.command.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.command.d.mts","sourceRoot":"","sources":["../../../src/overrides/help.command.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"help.command.d.mts","sourceRoot":"","sources":["../../../src/overrides/help.command.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAM1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AAEjF,QAAA,MAAM,iBAAiB;;iBAErB,CAAA;AAEF,KAAK,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEpD;;;;GAIG;AACH,qBAOa,WAAY,YAAW,cAAc,CAAC,WAAW,CAAC;IAC7D,OAAO,CAAC,MAAM,CAA4D;IAC1E,OAAO,CAAC,eAAe,CAAiC;IAElD,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAMjD;CACF"}
|