@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
package/lib/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as CommanderExecutionContext, c as extractCommandMetadata, d as CliAdapterOptions, f as CliEnvironment, i as CommandOptions, l as getCommandMetadata, m as CommandHandler, n as CliModuleOptions, o as CommandMetadata, p as AbstractCliAdapterInterface, r as Command, s as CommandMetadataKey, t as CliModule, u as hasCommandMetadata } from "./cli-module.decorator-
|
|
1
|
+
import { a as CommanderExecutionContext, c as extractCommandMetadata, d as CliAdapterOptions, f as CliEnvironment, i as CommandOptions, l as getCommandMetadata, m as CommandHandler, n as CliModuleOptions, o as CommandMetadata, p as AbstractCliAdapterInterface, r as Command, s as CommandMetadataKey, t as CliModule, u as hasCommandMetadata } from "./cli-module.decorator-DDlgpTgI.mjs";
|
|
2
2
|
import { AnyInjectableType, ClassType, ClassTypeWithInstance, InjectionToken, LogLevel, ModuleMetadata, NaviosApplication, NaviosModule } from "@navios/core";
|
|
3
|
-
import {
|
|
3
|
+
import { z } from "zod/v4";
|
|
4
4
|
export * from "@navios/core";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/help.command.d.mts
|
|
@@ -28,39 +28,39 @@ declare class HelpCommand implements CommandHandler<HelpOptions> {
|
|
|
28
28
|
*/
|
|
29
29
|
interface CommanderLoggerOptions {
|
|
30
30
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
* Enabled log levels.
|
|
32
|
+
* @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']
|
|
33
|
+
*/
|
|
34
34
|
logLevels?: LogLevel[];
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
* If true, will print the process ID in the log message.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
39
|
showPid?: boolean;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
* If true, will print the log level in the log message.
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
44
|
showLogLevel?: boolean;
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
* If true, will print the prefix/app name in the log message.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
49
|
showPrefix?: boolean;
|
|
50
50
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
* If true, will print the context in the log message.
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
54
|
showContext?: boolean;
|
|
55
55
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
* If true, will print the absolute timestamp in the log message.
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
59
|
showTimestamp?: boolean;
|
|
60
60
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
* If enabled, will print timestamp difference between current and previous log message.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
64
|
showTimeDiff?: boolean;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
@@ -71,52 +71,52 @@ interface CommanderLoggerOptions {
|
|
|
71
71
|
*/
|
|
72
72
|
interface CommanderTuiOptions {
|
|
73
73
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
* Exit on Ctrl+C.
|
|
75
|
+
* @default true
|
|
76
|
+
*/
|
|
77
77
|
exitOnCtrlC?: boolean;
|
|
78
78
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
* Adapter to use for the TUI.
|
|
80
|
+
* @default 'none'
|
|
81
|
+
*/
|
|
82
82
|
adapter?: 'react' | 'solid' | 'ink' | 'none';
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
* Sidebar width in columns.
|
|
85
|
+
*/
|
|
86
86
|
sidebarWidth?: number;
|
|
87
87
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
* Sidebar position.
|
|
89
|
+
*/
|
|
90
90
|
sidebarPosition?: 'left' | 'right';
|
|
91
91
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
* Sidebar header title.
|
|
93
|
+
*/
|
|
94
94
|
sidebarTitle?: string;
|
|
95
95
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
* Auto close after all screens complete successfully.
|
|
97
|
+
* Set to true for default delay (5000ms), or specify delay in milliseconds.
|
|
98
|
+
*/
|
|
99
99
|
autoClose?: boolean | number;
|
|
100
100
|
/**
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
* Theme preset name ('dark', 'light', 'high-contrast') or custom theme object.
|
|
102
|
+
*/
|
|
103
103
|
theme?: string | Record<string, unknown>;
|
|
104
104
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
* Enable mouse support.
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
108
|
useMouse?: boolean;
|
|
109
109
|
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
* Hide the default console logger screen from the sidebar.
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
113
113
|
hideDefaultScreen?: boolean;
|
|
114
114
|
/**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
* Use OpenTUI for terminal rendering.
|
|
116
|
+
* When true: Full TUI with sidebar, scrolling, interactive prompts.
|
|
117
|
+
* When false: Stdout mode - static screens print immediately, others on completion.
|
|
118
|
+
* @default true for Node.js, false for Bun (OpenTUI not supported)
|
|
119
|
+
*/
|
|
120
120
|
useOpenTUI?: boolean;
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
@@ -126,23 +126,23 @@ interface CommanderTuiOptions {
|
|
|
126
126
|
*/
|
|
127
127
|
interface CommanderFactoryOptions {
|
|
128
128
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
* Enabled log levels.
|
|
130
|
+
* @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']
|
|
131
|
+
*/
|
|
132
132
|
logLevels?: LogLevel[];
|
|
133
133
|
/**
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
* Logger display options. These override the default CLI-friendly logger settings.
|
|
135
|
+
* Ignored when enableTUI is true.
|
|
136
|
+
*/
|
|
137
137
|
logger?: CommanderLoggerOptions;
|
|
138
138
|
/**
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
* Enable TUI mode with @navios/commander-tui.
|
|
140
|
+
* Requires @navios/commander-tui to be installed.
|
|
141
|
+
*/
|
|
142
142
|
enableTUI?: boolean;
|
|
143
143
|
/**
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
* TUI-specific options. Only used when enableTUI is true.
|
|
145
|
+
*/
|
|
146
146
|
tuiOptions?: CommanderTuiOptions;
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
@@ -181,76 +181,97 @@ interface CommanderFactoryOptions {
|
|
|
181
181
|
*/
|
|
182
182
|
declare class CommanderFactory {
|
|
183
183
|
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
184
|
+
* Creates a new CLI application instance configured with the provided module.
|
|
185
|
+
*
|
|
186
|
+
* @param appModule - The root CLI module class decorated with `@CliModule`
|
|
187
|
+
* @param options - Optional configuration options for the CLI application
|
|
188
|
+
* @returns A promise that resolves to a configured NaviosApplication instance
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const app = await CommanderFactory.create(AppModule)
|
|
193
|
+
* await app.init()
|
|
194
|
+
*
|
|
195
|
+
* const adapter = app.getAdapter()
|
|
196
|
+
* await adapter.run(process.argv)
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
199
|
static create<TModule extends NaviosModule = NaviosModule>(appModule: ClassTypeWithInstance<TModule>, options?: CommanderFactoryOptions): Promise<NaviosApplication<CliEnvironment>>;
|
|
200
200
|
}
|
|
201
201
|
//#endregion
|
|
202
|
-
//#region src/services/
|
|
202
|
+
//#region src/services/cli-parser.service.d.mts
|
|
203
203
|
/**
|
|
204
|
-
*
|
|
205
|
-
* Handles command discovery, registration, parsing, and execution.
|
|
204
|
+
* Result of parsing command-line arguments.
|
|
206
205
|
*
|
|
207
206
|
* @public
|
|
208
207
|
*/
|
|
209
|
-
|
|
210
|
-
private container;
|
|
211
|
-
private commandRegistry;
|
|
212
|
-
private cliParser;
|
|
213
|
-
private logger;
|
|
214
|
-
private options;
|
|
215
|
-
private isReady;
|
|
208
|
+
interface ParsedCliArgs {
|
|
216
209
|
/**
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
210
|
+
* The command path (e.g., 'greet', 'user:create').
|
|
211
|
+
* Multi-word commands are joined with spaces.
|
|
212
|
+
*/
|
|
213
|
+
command: string;
|
|
221
214
|
/**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
215
|
+
* Parsed options as key-value pairs.
|
|
216
|
+
* Keys are converted from kebab-case to camelCase.
|
|
217
|
+
*/
|
|
218
|
+
options: Record<string, any>;
|
|
226
219
|
/**
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
220
|
+
* Positional arguments that don't match any option flags.
|
|
221
|
+
*/
|
|
222
|
+
positionals: string[];
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Service for parsing command-line arguments.
|
|
226
|
+
*
|
|
227
|
+
* Handles parsing of various CLI argument formats including:
|
|
228
|
+
* - Long options: `--key value` or `--key=value`
|
|
229
|
+
* - Short options: `-k value` or `-abc` (multiple flags)
|
|
230
|
+
* - Boolean flags
|
|
231
|
+
* - Array options
|
|
232
|
+
* - Positional arguments
|
|
233
|
+
*
|
|
234
|
+
* @public
|
|
235
|
+
*/
|
|
236
|
+
declare class CliParserService {
|
|
230
237
|
/**
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
238
|
+
* Parses command-line arguments from process.argv
|
|
239
|
+
* Commands can be multi-word (e.g., 'db migrate', 'cache clear')
|
|
240
|
+
* Expected format: node script.js command [subcommand...] --flag value --boolean-flag positional1 positional2
|
|
241
|
+
*
|
|
242
|
+
* @param argv - Array of command-line arguments (typically process.argv)
|
|
243
|
+
* @param optionsSchema - Optional zod/v4 schema to determine boolean flags and option types
|
|
244
|
+
* @returns Parsed command (space-separated if multi-word), options, and positional arguments
|
|
245
|
+
*/
|
|
246
|
+
parse(argv: string[], optionsSchema?: z.ZodObject): ParsedCliArgs;
|
|
247
|
+
/**
|
|
248
|
+
* Converts kebab-case to camelCase
|
|
249
|
+
*/
|
|
250
|
+
private camelCase;
|
|
234
251
|
/**
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
252
|
+
* Attempts to parse string values into appropriate types
|
|
253
|
+
*/
|
|
254
|
+
private parseValue;
|
|
238
255
|
/**
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
256
|
+
* Extracts boolean field names from a zod/v4 schema
|
|
257
|
+
* Handles z.ZodObject, zod/v4Optional, and zod/v4Default wrappers
|
|
258
|
+
*/
|
|
259
|
+
private extractBooleanFields;
|
|
243
260
|
/**
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
261
|
+
* Extracts array field names from a zod/v4 schema
|
|
262
|
+
* Handles z.ZodObject, zod/v4Optional, and zod/v4Default wrappers
|
|
263
|
+
*/
|
|
264
|
+
private extractArrayFields;
|
|
247
265
|
/**
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
266
|
+
* Checks if a zod/v4 schema represents a boolean type
|
|
267
|
+
* Unwraps zod/v4Optional and zod/v4Default using zod/v4 v4 API
|
|
268
|
+
*/
|
|
269
|
+
private isSchemaBoolean;
|
|
270
|
+
/**
|
|
271
|
+
* Checks if a zod/v4 schema represents an array type
|
|
272
|
+
* Unwraps zod/v4Optional and zod/v4Default using zod/v4 v4 API
|
|
273
|
+
*/
|
|
274
|
+
private isSchemaArray;
|
|
254
275
|
}
|
|
255
276
|
//#endregion
|
|
256
277
|
//#region src/metadata/command-entry.metadata.d.mts
|
|
@@ -292,16 +313,16 @@ declare function extractModuleCommands(moduleClass: ClassType): Set<ClassType>;
|
|
|
292
313
|
*/
|
|
293
314
|
interface RegisteredCommand {
|
|
294
315
|
/**
|
|
295
|
-
|
|
296
|
-
|
|
316
|
+
* The command class
|
|
317
|
+
*/
|
|
297
318
|
class: ClassType;
|
|
298
319
|
/**
|
|
299
|
-
|
|
300
|
-
|
|
320
|
+
* The command metadata from @Command decorator
|
|
321
|
+
*/
|
|
301
322
|
metadata: CommandMetadata;
|
|
302
323
|
/**
|
|
303
|
-
|
|
304
|
-
|
|
324
|
+
* Name of the module this command belongs to
|
|
325
|
+
*/
|
|
305
326
|
moduleName: string;
|
|
306
327
|
}
|
|
307
328
|
/**
|
|
@@ -313,138 +334,117 @@ interface RegisteredCommand {
|
|
|
313
334
|
declare class CommandRegistryService {
|
|
314
335
|
private commands;
|
|
315
336
|
/**
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
337
|
+
* Register a command with its metadata.
|
|
338
|
+
*
|
|
339
|
+
* @param path - The command path (e.g., 'greet', 'user:create')
|
|
340
|
+
* @param command - The registered command data
|
|
341
|
+
* @throws Error if a command with the same path is already registered
|
|
342
|
+
*/
|
|
322
343
|
register(path: string, command: RegisteredCommand): void;
|
|
323
344
|
/**
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
345
|
+
* Get a command by its path.
|
|
346
|
+
*
|
|
347
|
+
* @param path - The command path
|
|
348
|
+
* @returns The registered command or undefined if not found
|
|
349
|
+
*/
|
|
329
350
|
getByPath(path: string): RegisteredCommand | undefined;
|
|
330
351
|
/**
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
352
|
+
* Get all registered commands.
|
|
353
|
+
*
|
|
354
|
+
* @returns Map of path to registered command
|
|
355
|
+
*/
|
|
335
356
|
getAll(): Map<string, RegisteredCommand>;
|
|
336
357
|
/**
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
358
|
+
* Get all registered commands as an array of path and class pairs.
|
|
359
|
+
* Useful for listing available commands.
|
|
360
|
+
*
|
|
361
|
+
* @returns Array of objects containing path and class
|
|
362
|
+
*/
|
|
342
363
|
getAllAsArray(): Array<{
|
|
343
364
|
path: string;
|
|
344
365
|
class: ClassType;
|
|
345
366
|
}>;
|
|
346
367
|
/**
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
368
|
+
* Formats help text listing all available commands with descriptions.
|
|
369
|
+
*
|
|
370
|
+
* @returns Formatted string listing all commands
|
|
371
|
+
*/
|
|
351
372
|
formatCommandList(): string;
|
|
352
373
|
/**
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
374
|
+
* Formats help text for a specific command.
|
|
375
|
+
*
|
|
376
|
+
* @param commandPath - The command path to show help for
|
|
377
|
+
* @returns Formatted string with command help
|
|
378
|
+
*/
|
|
358
379
|
formatCommandHelp(commandPath: string): string;
|
|
359
380
|
/**
|
|
360
|
-
|
|
361
|
-
|
|
381
|
+
* Gets a human-readable type name from a zod/v4 schema.
|
|
382
|
+
*/
|
|
362
383
|
private getSchemaTypeName;
|
|
363
384
|
/**
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
385
|
+
* Gets metadata from a zod/v4 schema, traversing innerType if needed.
|
|
386
|
+
* zod/v4 v4 stores meta at the outermost layer when .meta() is called last,
|
|
387
|
+
* or in innerType when .meta() is called before .optional()/.default().
|
|
388
|
+
*/
|
|
368
389
|
private getSchemaMeta;
|
|
369
390
|
/**
|
|
370
|
-
|
|
371
|
-
|
|
391
|
+
* Clear all registered commands.
|
|
392
|
+
*/
|
|
372
393
|
clear(): void;
|
|
373
394
|
}
|
|
374
395
|
//#endregion
|
|
375
|
-
//#region src/services/
|
|
396
|
+
//#region src/services/commander-adapter.service.d.mts
|
|
376
397
|
/**
|
|
377
|
-
*
|
|
398
|
+
* CLI adapter service that implements the AbstractCliAdapterInterface.
|
|
399
|
+
* Handles command discovery, registration, parsing, and execution.
|
|
378
400
|
*
|
|
379
401
|
* @public
|
|
380
402
|
*/
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
403
|
+
declare class CommanderAdapterService implements AbstractCliAdapterInterface {
|
|
404
|
+
private container;
|
|
405
|
+
private commandRegistry;
|
|
406
|
+
private cliParser;
|
|
407
|
+
private logger;
|
|
408
|
+
private options;
|
|
409
|
+
private isReady;
|
|
387
410
|
/**
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
options:
|
|
411
|
+
* Sets up the adapter with the provided options.
|
|
412
|
+
* Called during application initialization.
|
|
413
|
+
*/
|
|
414
|
+
setupAdapter(options: CliAdapterOptions): Promise<void>;
|
|
392
415
|
/**
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Service for parsing command-line arguments.
|
|
399
|
-
*
|
|
400
|
-
* Handles parsing of various CLI argument formats including:
|
|
401
|
-
* - Long options: `--key value` or `--key=value`
|
|
402
|
-
* - Short options: `-k value` or `-abc` (multiple flags)
|
|
403
|
-
* - Boolean flags
|
|
404
|
-
* - Array options
|
|
405
|
-
* - Positional arguments
|
|
406
|
-
*
|
|
407
|
-
* @public
|
|
408
|
-
*/
|
|
409
|
-
declare class CliParserService {
|
|
416
|
+
* Called after all modules are loaded.
|
|
417
|
+
* Iterates through modules and extracts commands from customEntries.
|
|
418
|
+
*/
|
|
419
|
+
onModulesInit(modules: Map<string, ModuleMetadata>): Promise<void>;
|
|
410
420
|
/**
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
*
|
|
415
|
-
* @param argv - Array of command-line arguments (typically process.argv)
|
|
416
|
-
* @param optionsSchema - Optional Zod schema to determine boolean flags and option types
|
|
417
|
-
* @returns Parsed command (space-separated if multi-word), options, and positional arguments
|
|
418
|
-
*/
|
|
419
|
-
parse(argv: string[], optionsSchema?: ZodObject): ParsedCliArgs;
|
|
420
|
-
/**
|
|
421
|
-
* Converts kebab-case to camelCase
|
|
422
|
-
*/
|
|
423
|
-
private camelCase;
|
|
421
|
+
* Registers built-in commands like help.
|
|
422
|
+
*/
|
|
423
|
+
private registerBuiltInCommands;
|
|
424
424
|
/**
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
425
|
+
* Signals that the adapter is ready to handle commands.
|
|
426
|
+
*/
|
|
427
|
+
ready(): Promise<void>;
|
|
428
428
|
/**
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
private extractBooleanFields;
|
|
429
|
+
* Disposes of the adapter and cleans up resources.
|
|
430
|
+
*/
|
|
431
|
+
dispose(): Promise<void>;
|
|
433
432
|
/**
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
433
|
+
* Run the CLI application with the given arguments.
|
|
434
|
+
* Parses arguments and executes the matching command.
|
|
435
|
+
*/
|
|
436
|
+
run(argv?: string[]): Promise<void>;
|
|
438
437
|
/**
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
private isSchemaBoolean;
|
|
438
|
+
* Execute a command programmatically with the provided options.
|
|
439
|
+
*/
|
|
440
|
+
executeCommand(path: string, options?: Record<string, unknown>, positionals?: string[]): Promise<void>;
|
|
443
441
|
/**
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
442
|
+
* Get all registered command paths and their class references.
|
|
443
|
+
*/
|
|
444
|
+
getAllCommands(): Array<{
|
|
445
|
+
path: string;
|
|
446
|
+
class: ClassType;
|
|
447
|
+
}>;
|
|
448
448
|
}
|
|
449
449
|
//#endregion
|
|
450
450
|
//#region src/define-environment.d.mts
|
package/lib/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["z","CommandHandler","helpOptionsSchema","ZodString","ZodOptional","core","$strip","ZodObject","HelpOptions","infer","HelpCommand","Promise","ClassTypeWithInstance","LogLevel","NaviosApplication","NaviosModule","CliEnvironment","CommanderLoggerOptions","CommanderTuiOptions","Record","CommanderFactoryOptions","CommanderFactory","TModule","Promise","ClassType","ModuleMetadata","AbstractCliAdapterInterface","CliAdapterOptions","CommanderAdapterService","Promise","Map","Record","Array","ClassType","CommandEntryKey","CommandEntryValue","Set","extractModuleCommands","ClassType","CommandMetadata","RegisteredCommand","CommandRegistryService","Map","Array","ZodObject","ParsedCliArgs","Record","CliParserService","AnyInjectableType","InjectionToken","CommanderAdapterService","CommandRegistryService","CliParserService","defineCliEnvironment","Map","InjectionToken","CommanderExecutionContext","CommandExecutionContext"],"sources":["../src/commands/help.command.d.mts","../src/commander.factory.d.mts","../src/services/commander-adapter.service.d.mts","../src/metadata/command-entry.metadata.d.mts","../src/services/command-registry.service.d.mts","../src/services/cli-parser.service.d.mts","../src/define-environment.d.mts","../src/tokens/execution-context.token.d.mts"],"mappings":";;;;;;cAEcE,iBAAAA,EAAmBF,CAAAA,CAAEO,SAAAA;EAAAA,OAAAA,EACtBP,CAAAA,CAAEI,WAAAA,CAAYJ,CAAAA,CAAEG,SAAAA;AAAAA,GAC1BH,CAAAA,CAAEK,IAAAA,CAAKC,MAAAA;AAAAA,KACLE,WAAAA,GAAcR,CAAAA,CAAES,KAAAA,QAAaP,iBAAAA;AAAAA;AAMlC;;;;AANkCA,cAMbQ,WAAAA,YAAuBT,cAAAA,CAAeO,WAAAA;EAAAA,QAAAA,MAAAA;EAAAA,QAAAA,eAAAA;EAAAA,QAAAA,OAAAA,EAGtCA,WAAAA,GAAcG,OAAAA;AAAAA;;;;ACNnC;AA2CA;AAuDA;;;UAlGiBM,sBAAAA;EAAAA;AA2CjB;AAuDA;;EAlGiBA,SAAAA,GAKDJ,QAAAA;EAAAA;AAsChB;AAuDA;;EA7FgBA,OAAAA;EAAAA;AAsChB;AAuDA;;EA7FgBA,YAAAA;EAAAA;AAsChB;AAuDA;;EA7FgBA,UAAAA;EAAAA;AAsChB;AAuDA;;EA7FgBA,WAAAA;EAAAA;AAsChB;AAuDA;;EA7FgBA,aAAAA;EAAAA;AAsChB;AAuDA;;EA7FgBA,YAAAA;AAAAA;AAAAA;AAsChB;AAuDA;;;;AA7FgBA,UAsCCK,mBAAAA;EAAAA;AAuDjB;;;E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5BiBO,aAAAA;EAAAA;AA4BjB;;;EA5BiBA,OAAAA;EAAAA;AA4BjB;;;EA5BiBA,OAAAA,EAUJC,MAAAA;EAAAA;AAkBb;;EAlBaA,WAAAA;AAAAA;AAAAA;AAkBb;;;;ACRA;;;;;;;ADVaA,cAkBQC,gBAAAA;EAAAA;;;;ACRrB;;;;;EDQqBA,MAAAA,IAAAA,YAAAA,aAAAA,GAUqBH,SAAAA,GAAYC,aAAAA;EAAAA;;;EAAAA,QAAAA,SAAAA;EAAAA;;;EAAAA,QAAAA,UAAAA;EAAAA;;;;EAAAA,QAAAA,oBAAAA;EAAAA;;;;EAAAA,QAAAA,kBAAAA;EAAAA;;;;EAAAA,QAAAA,eAAAA;EAAAA;;;;EAAAA,QAAAA,aAAAA;AAAAA;;;;AClBtD;;;;;;;;ACDA;;;;;;;;;;;;;iBDCwBQ,oBAAAA,CAAAA;EAAAA,MAAAA,EACZC,GAAAA,CAAIL,cAAAA,yBAAuCD,iBAAAA;AAAAA;;;;ACFvD;;;;;;;;;;;;;;;;;;;;;;cAAqBS,uBAAAA,EAAyBF,cAAAA,CAAeC,yBAAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["z","CommandHandler","helpOptionsSchema","ZodString","ZodOptional","core","$strip","ZodObject","HelpOptions","infer","HelpCommand","Promise","ClassTypeWithInstance","LogLevel","NaviosApplication","NaviosModule","CliEnvironment","CommanderLoggerOptions","CommanderTuiOptions","Record","CommanderFactoryOptions","CommanderFactory","TModule","Promise","z","ParsedCliArgs","Record","CliParserService","ZodObject","ClassType","CommandEntryKey","CommandEntryValue","Set","extractModuleCommands","ClassType","CommandMetadata","RegisteredCommand","CommandRegistryService","Map","Array","ClassType","ModuleMetadata","AbstractCliAdapterInterface","CliAdapterOptions","CommanderAdapterService","Promise","Map","Record","Array","AnyInjectableType","InjectionToken","CliParserService","CommandRegistryService","CommanderAdapterService","defineCliEnvironment","Map","InjectionToken","CommanderExecutionContext","CommandExecutionContext"],"sources":["../src/commands/help.command.d.mts","../src/commander.factory.d.mts","../src/services/cli-parser.service.d.mts","../src/metadata/command-entry.metadata.d.mts","../src/services/command-registry.service.d.mts","../src/services/commander-adapter.service.d.mts","../src/define-environment.d.mts","../src/tokens/execution-context.token.d.mts"],"sourcesContent":["import { z } from 'zod/v4'\n\nimport type { CommandHandler } from '../interfaces/command-handler.interface.mjs'\ndeclare const helpOptionsSchema: z.ZodObject<\n {\n command: z.ZodOptional<z.ZodString>\n },\n z.core.$strip\n>\ntype HelpOptions = z.infer<typeof helpOptionsSchema>\n/**\n * Built-in help command that lists all available commands or shows help for a specific command.\n *\n * @public\n */\nexport declare class HelpCommand implements CommandHandler<HelpOptions> {\n private logger\n private commandRegistry\n execute(options: HelpOptions): Promise<void>\n}\nexport {}\n//# sourceMappingURL=help.command.d.mts.map\n","import type { ClassTypeWithInstance, LogLevel, NaviosApplication, NaviosModule } from '@navios/core'\n\nimport type { CliEnvironment } from './interfaces/environment.interface.mjs'\n/**\n * Logger display options for CLI applications.\n * All options default to false for cleaner CLI output.\n *\n * @public\n */\nexport interface CommanderLoggerOptions {\n /**\n * Enabled log levels.\n * @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']\n */\n logLevels?: LogLevel[]\n /**\n * If true, will print the process ID in the log message.\n * @default false\n */\n showPid?: boolean\n /**\n * If true, will print the log level in the log message.\n * @default true\n */\n showLogLevel?: boolean\n /**\n * If true, will print the prefix/app name in the log message.\n * @default false\n */\n showPrefix?: boolean\n /**\n * If true, will print the context in the log message.\n * @default true\n */\n showContext?: boolean\n /**\n * If true, will print the absolute timestamp in the log message.\n * @default false\n */\n showTimestamp?: boolean\n /**\n * If enabled, will print timestamp difference between current and previous log message.\n * @default false\n */\n showTimeDiff?: boolean\n}\n/**\n * TUI-specific options for terminal UI mode.\n * Only used when enableTUI is true.\n *\n * @public\n */\nexport interface CommanderTuiOptions {\n /**\n * Exit on Ctrl+C.\n * @default true\n */\n exitOnCtrlC?: boolean\n /**\n * Adapter to use for the TUI.\n * @default 'none'\n */\n adapter?: 'react' | 'solid' | 'ink' | 'none'\n /**\n * Sidebar width in columns.\n */\n sidebarWidth?: number\n /**\n * Sidebar position.\n */\n sidebarPosition?: 'left' | 'right'\n /**\n * Sidebar header title.\n */\n sidebarTitle?: string\n /**\n * Auto close after all screens complete successfully.\n * Set to true for default delay (5000ms), or specify delay in milliseconds.\n */\n autoClose?: boolean | number\n /**\n * Theme preset name ('dark', 'light', 'high-contrast') or custom theme object.\n */\n theme?: string | Record<string, unknown>\n /**\n * Enable mouse support.\n * @default false\n */\n useMouse?: boolean\n /**\n * Hide the default console logger screen from the sidebar.\n * @default false\n */\n hideDefaultScreen?: boolean\n /**\n * Use OpenTUI for terminal rendering.\n * When true: Full TUI with sidebar, scrolling, interactive prompts.\n * When false: Stdout mode - static screens print immediately, others on completion.\n * @default true for Node.js, false for Bun (OpenTUI not supported)\n */\n useOpenTUI?: boolean\n}\n/**\n * Configuration options for CommanderFactory.\n *\n * @public\n */\nexport interface CommanderFactoryOptions {\n /**\n * Enabled log levels.\n * @default ['log', 'error', 'warn', 'debug', 'verbose', 'fatal']\n */\n logLevels?: LogLevel[]\n /**\n * Logger display options. These override the default CLI-friendly logger settings.\n * Ignored when enableTUI is true.\n */\n logger?: CommanderLoggerOptions\n /**\n * Enable TUI mode with @navios/commander-tui.\n * Requires @navios/commander-tui to be installed.\n */\n enableTUI?: boolean\n /**\n * TUI-specific options. Only used when enableTUI is true.\n */\n tuiOptions?: CommanderTuiOptions\n}\n/**\n * Factory class for creating CLI applications.\n *\n * This is a convenience wrapper around `NaviosFactory.create()` that\n * configures everything needed for CLI usage. It sets up the CLI adapter\n * and returns a typed `NaviosApplication<CliEnvironment>`.\n *\n * @example\n * ```typescript\n * import { CommanderFactory } from '@navios/commander'\n * import { AppModule } from './app.module'\n *\n * async function bootstrap() {\n * const app = await CommanderFactory.create(AppModule)\n * await app.init()\n *\n * const adapter = app.getAdapter()\n * await adapter.run(process.argv)\n *\n * await app.close()\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Alternative: use NaviosFactory directly\n * import { NaviosFactory } from '@navios/core'\n * import { defineCliEnvironment, type CliEnvironment } from '@navios/commander'\n *\n * const app = await NaviosFactory.create<CliEnvironment>(AppModule, {\n * adapter: defineCliEnvironment(),\n * })\n * ```\n */\nexport declare class CommanderFactory {\n /**\n * Creates a new CLI application instance configured with the provided module.\n *\n * @param appModule - The root CLI module class decorated with `@CliModule`\n * @param options - Optional configuration options for the CLI application\n * @returns A promise that resolves to a configured NaviosApplication instance\n *\n * @example\n * ```typescript\n * const app = await CommanderFactory.create(AppModule)\n * await app.init()\n *\n * const adapter = app.getAdapter()\n * await adapter.run(process.argv)\n * ```\n */\n static create<TModule extends NaviosModule = NaviosModule>(\n appModule: ClassTypeWithInstance<TModule>,\n options?: CommanderFactoryOptions,\n ): Promise<NaviosApplication<CliEnvironment>>\n}\n//# sourceMappingURL=commander.factory.d.mts.map\n","import type { z } from 'zod/v4'\n/**\n * Result of parsing command-line arguments.\n *\n * @public\n */\nexport interface ParsedCliArgs {\n /**\n * The command path (e.g., 'greet', 'user:create').\n * Multi-word commands are joined with spaces.\n */\n command: string\n /**\n * Parsed options as key-value pairs.\n * Keys are converted from kebab-case to camelCase.\n */\n options: Record<string, any>\n /**\n * Positional arguments that don't match any option flags.\n */\n positionals: string[]\n}\n/**\n * Service for parsing command-line arguments.\n *\n * Handles parsing of various CLI argument formats including:\n * - Long options: `--key value` or `--key=value`\n * - Short options: `-k value` or `-abc` (multiple flags)\n * - Boolean flags\n * - Array options\n * - Positional arguments\n *\n * @public\n */\nexport declare class CliParserService {\n /**\n * Parses command-line arguments from process.argv\n * Commands can be multi-word (e.g., 'db migrate', 'cache clear')\n * Expected format: node script.js command [subcommand...] --flag value --boolean-flag positional1 positional2\n *\n * @param argv - Array of command-line arguments (typically process.argv)\n * @param optionsSchema - Optional zod/v4 schema to determine boolean flags and option types\n * @returns Parsed command (space-separated if multi-word), options, and positional arguments\n */\n parse(argv: string[], optionsSchema?: z.ZodObject): ParsedCliArgs\n /**\n * Converts kebab-case to camelCase\n */\n private camelCase\n /**\n * Attempts to parse string values into appropriate types\n */\n private parseValue\n /**\n * Extracts boolean field names from a zod/v4 schema\n * Handles z.ZodObject, zod/v4Optional, and zod/v4Default wrappers\n */\n private extractBooleanFields\n /**\n * Extracts array field names from a zod/v4 schema\n * Handles z.ZodObject, zod/v4Optional, and zod/v4Default wrappers\n */\n private extractArrayFields\n /**\n * Checks if a zod/v4 schema represents a boolean type\n * Unwraps zod/v4Optional and zod/v4Default using zod/v4 v4 API\n */\n private isSchemaBoolean\n /**\n * Checks if a zod/v4 schema represents an array type\n * Unwraps zod/v4Optional and zod/v4Default using zod/v4 v4 API\n */\n private isSchemaArray\n}\n//# sourceMappingURL=cli-parser.service.d.mts.map\n","import type { ClassType } from '@navios/core'\n/**\n * Symbol key for storing commands in ModuleMetadata.customEntries.\n * Used by @CliModule to store command classes.\n *\n * @public\n */\nexport declare const CommandEntryKey: unique symbol\n/**\n * Type for the command entry value stored in customEntries.\n *\n * @public\n */\nexport type CommandEntryValue = Set<ClassType>\n/**\n * Extracts commands from a module's metadata.\n * Returns empty set if no commands are defined.\n *\n * @param moduleClass - The module class decorated with @CliModule or @Module\n * @returns Set of command classes registered in the module\n *\n * @example\n * ```typescript\n * const commands = extractModuleCommands(AppModule)\n * for (const command of commands) {\n * console.log(command.name)\n * }\n * ```\n */\nexport declare function extractModuleCommands(moduleClass: ClassType): Set<ClassType>\n//# sourceMappingURL=command-entry.metadata.d.mts.map\n","import type { ClassType } from '@navios/core'\n\nimport type { CommandMetadata } from '../metadata/index.mjs'\n/**\n * Represents a registered command with its metadata and module information.\n *\n * @public\n */\nexport interface RegisteredCommand {\n /**\n * The command class\n */\n class: ClassType\n /**\n * The command metadata from @Command decorator\n */\n metadata: CommandMetadata\n /**\n * Name of the module this command belongs to\n */\n moduleName: string\n}\n/**\n * Service for registering and looking up CLI commands.\n * Used internally by the CLI adapter to manage discovered commands.\n *\n * @public\n */\nexport declare class CommandRegistryService {\n private commands\n /**\n * Register a command with its metadata.\n *\n * @param path - The command path (e.g., 'greet', 'user:create')\n * @param command - The registered command data\n * @throws Error if a command with the same path is already registered\n */\n register(path: string, command: RegisteredCommand): void\n /**\n * Get a command by its path.\n *\n * @param path - The command path\n * @returns The registered command or undefined if not found\n */\n getByPath(path: string): RegisteredCommand | undefined\n /**\n * Get all registered commands.\n *\n * @returns Map of path to registered command\n */\n getAll(): Map<string, RegisteredCommand>\n /**\n * Get all registered commands as an array of path and class pairs.\n * Useful for listing available commands.\n *\n * @returns Array of objects containing path and class\n */\n getAllAsArray(): Array<{\n path: string\n class: ClassType\n }>\n /**\n * Formats help text listing all available commands with descriptions.\n *\n * @returns Formatted string listing all commands\n */\n formatCommandList(): string\n /**\n * Formats help text for a specific command.\n *\n * @param commandPath - The command path to show help for\n * @returns Formatted string with command help\n */\n formatCommandHelp(commandPath: string): string\n /**\n * Gets a human-readable type name from a zod/v4 schema.\n */\n private getSchemaTypeName\n /**\n * Gets metadata from a zod/v4 schema, traversing innerType if needed.\n * zod/v4 v4 stores meta at the outermost layer when .meta() is called last,\n * or in innerType when .meta() is called before .optional()/.default().\n */\n private getSchemaMeta\n /**\n * Clear all registered commands.\n */\n clear(): void\n}\n//# sourceMappingURL=command-registry.service.d.mts.map\n","import type { ClassType, ModuleMetadata } from '@navios/core'\n\nimport type { AbstractCliAdapterInterface } from '../interfaces/abstract-cli-adapter.interface.mjs'\nimport type { CliAdapterOptions } from '../interfaces/environment.interface.mjs'\n/**\n * CLI adapter service that implements the AbstractCliAdapterInterface.\n * Handles command discovery, registration, parsing, and execution.\n *\n * @public\n */\nexport declare class CommanderAdapterService implements AbstractCliAdapterInterface {\n private container\n private commandRegistry\n private cliParser\n private logger\n private options\n private isReady\n /**\n * Sets up the adapter with the provided options.\n * Called during application initialization.\n */\n setupAdapter(options: CliAdapterOptions): Promise<void>\n /**\n * Called after all modules are loaded.\n * Iterates through modules and extracts commands from customEntries.\n */\n onModulesInit(modules: Map<string, ModuleMetadata>): Promise<void>\n /**\n * Registers built-in commands like help.\n */\n private registerBuiltInCommands\n /**\n * Signals that the adapter is ready to handle commands.\n */\n ready(): Promise<void>\n /**\n * Disposes of the adapter and cleans up resources.\n */\n dispose(): Promise<void>\n /**\n * Run the CLI application with the given arguments.\n * Parses arguments and executes the matching command.\n */\n run(argv?: string[]): Promise<void>\n /**\n * Execute a command programmatically with the provided options.\n */\n executeCommand(\n path: string,\n options?: Record<string, unknown>,\n positionals?: string[],\n ): Promise<void>\n /**\n * Get all registered command paths and their class references.\n */\n getAllCommands(): Array<{\n path: string\n class: ClassType\n }>\n}\n//# sourceMappingURL=commander-adapter.service.d.mts.map\n","import type { AnyInjectableType, InjectionToken } from '@navios/core'\n\nimport { CliParserService } from './services/cli-parser.service.mjs'\nimport { CommandRegistryService } from './services/command-registry.service.mjs'\nimport { CommanderAdapterService } from './services/commander-adapter.service.mjs'\n/**\n * Defines the CLI environment configuration for use with NaviosFactory.\n *\n * This function returns the token mappings needed to configure a CLI application.\n * Use it with `NaviosFactory.create()` to create a CLI application.\n *\n * @returns Environment configuration with token mappings\n *\n * @example\n * ```typescript\n * import { NaviosFactory } from '@navios/core'\n * import { defineCliEnvironment, type CliEnvironment } from '@navios/commander'\n *\n * const app = await NaviosFactory.create<CliEnvironment>(AppModule, {\n * adapter: defineCliEnvironment(),\n * })\n * await app.init()\n *\n * const adapter = app.getAdapter() as AbstractCliAdapterInterface\n * await adapter.run(process.argv)\n * ```\n */\nexport declare function defineCliEnvironment(): {\n tokens: Map<InjectionToken<any, undefined, false>, AnyInjectableType>\n}\nexport { CommanderAdapterService, CommandRegistryService, CliParserService }\n//# sourceMappingURL=define-environment.d.mts.map\n","import { InjectionToken } from '@navios/core'\n\nimport type { CommanderExecutionContext } from '../interfaces/index.mjs'\n/**\n * Injection token for accessing the current command execution context.\n *\n * Use this token with `inject()` to access the `CommanderExecutionContext` in services\n * that need information about the currently executing command.\n *\n * @example\n * ```typescript\n * import { inject, Injectable } from '@navios/core'\n * import { CommandExecutionContext } from '@navios/commander'\n *\n * @Injectable()\n * class MyService {\n * private ctx = inject(CommandExecutionContext)\n *\n * doSomething() {\n * const commandPath = this.ctx.getCommandPath()\n * const options = this.ctx.getOptions()\n * // Use context information...\n * }\n * }\n * ```\n */\nexport declare const CommandExecutionContext: InjectionToken<\n CommanderExecutionContext,\n undefined,\n false\n>\n//# sourceMappingURL=execution-context.token.d.mts.map\n"],"mappings":";;;;;;cAGcE,mBAAmBF,CAAAA,CAAEO;WAEtBP,CAAAA,CAAEI,YAAYJ,CAAAA,CAAEG;GAE3BH,CAAAA,CAAEK,IAAAA,CAAKC,MAJKJ,CAEaF;KAItBQ,WAAAA,GAAcR,CAAAA,CAAES,KAJNL,CAAAA,OAImBF,iBAJnBE,CAAAA;;;;AAF6B;AAY5C;AAA2DI,cAAtCE,WAAAA,YAAuBT,cAAeO,CAAAA,WAAAA,CAAAA,CAAAA;EAGxCA,QAAAA,MAAAA;EAAcG,QAAAA,eAAAA;EAHWV,OAAAA,CAAAA,OAAAA,EAGzBO,WAHyBP,CAAAA,EAGXU,OAHWV,CAAAA,IAAAA,CAAAA;;;;;;;;AAbqC;;AAGlEG,UCIEa,sBAAAA,CDJFb;EAEbJ;;;AAJ0C;EAY5C,SAAqBU,CAAAA,ECDPG,QDCkB,EAAA;EAA2BL;;;;EAAD,OAAA,CAAA,EAAA,OAAA;;;;ACN1D;EA2CA,YAAiBU,CAAAA,EAAAA,OAAAA;EAuDjB;;;;EAmBkC,UAAA,CAAA,EAAA,OAAA;EAoClC;;;;EAkBeN,WAAAA,CAAAA,EAAAA,OAAAA;EACDQ;;;;EACF,aAAA,CAAA,EAAA,OAAA;;;;AChLZ;EA4BA,YAAqBO,CAAAA,EAAAA,OAAgB;;;;AC3BrC;AAMA;AAgBA;;AAA2EE,UFuB1DX,mBAAAA,CEvB0DW;EAAJG;;;;;ECrBvE;AAoBA;;;EAsBwBI,OAAA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