@alcyone-labs/arg-parser 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/ConfigurationManager.d.ts +74 -0
- package/dist/config/ConfigurationManager.d.ts.map +1 -0
- package/dist/config/plugins/ConfigPlugin.d.ts +60 -0
- package/dist/config/plugins/ConfigPlugin.d.ts.map +1 -0
- package/dist/config/plugins/ConfigPluginRegistry.d.ts +72 -0
- package/dist/config/plugins/ConfigPluginRegistry.d.ts.map +1 -0
- package/dist/config/plugins/TomlConfigPlugin.d.ts +30 -0
- package/dist/config/plugins/TomlConfigPlugin.d.ts.map +1 -0
- package/dist/config/plugins/YamlConfigPlugin.d.ts +29 -0
- package/dist/config/plugins/YamlConfigPlugin.d.ts.map +1 -0
- package/dist/config/plugins/index.d.ts +5 -0
- package/dist/config/plugins/index.d.ts.map +1 -0
- package/dist/core/ArgParser.d.ts +380 -0
- package/dist/core/ArgParser.d.ts.map +1 -0
- package/dist/core/ArgParserBase.d.ts +206 -0
- package/dist/core/ArgParserBase.d.ts.map +1 -0
- package/dist/core/FlagManager.d.ts +16 -0
- package/dist/core/FlagManager.d.ts.map +1 -0
- package/dist/core/types.d.ts +355 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/dxt/DxtGenerator.d.ts +111 -0
- package/dist/dxt/DxtGenerator.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/mcp/ArgParserMcp.d.ts +21 -0
- package/dist/mcp/ArgParserMcp.d.ts.map +1 -0
- package/dist/mcp/mcp-integration.d.ts +86 -0
- package/dist/mcp/mcp-integration.d.ts.map +1 -0
- package/dist/mcp/mcp-notifications.d.ts +138 -0
- package/dist/mcp/mcp-notifications.d.ts.map +1 -0
- package/dist/mcp/mcp-prompts.d.ts +132 -0
- package/dist/mcp/mcp-prompts.d.ts.map +1 -0
- package/dist/mcp/mcp-protocol-versions.d.ts +150 -0
- package/dist/mcp/mcp-protocol-versions.d.ts.map +1 -0
- package/dist/mcp/mcp-resources.d.ts +133 -0
- package/dist/mcp/mcp-resources.d.ts.map +1 -0
- package/dist/testing/fuzzy-test-cli.d.ts +5 -0
- package/dist/testing/fuzzy-test-cli.d.ts.map +1 -0
- package/dist/testing/fuzzy-tester.d.ts +101 -0
- package/dist/testing/fuzzy-tester.d.ts.map +1 -0
- package/package.json +5 -3
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import type { GenerateMcpToolsOptions, IMcpToolStructure } from "../mcp/mcp-integration";
|
|
2
|
+
import { ArgParserBase, type IArgParserParams } from "./ArgParserBase";
|
|
3
|
+
import type { IFlag, IHandlerContext, OutputSchemaConfig } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for a single MCP transport
|
|
6
|
+
*/
|
|
7
|
+
export type McpTransportConfig = {
|
|
8
|
+
type: "stdio" | "sse" | "streamable-http";
|
|
9
|
+
port?: number;
|
|
10
|
+
host?: string;
|
|
11
|
+
path?: string;
|
|
12
|
+
sessionIdGenerator?: () => string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Configuration options for MCP sub-command
|
|
16
|
+
*/
|
|
17
|
+
export type McpSubCommandOptions = {
|
|
18
|
+
/** Preset transport configurations to use when no CLI flags are provided */
|
|
19
|
+
defaultTransports?: McpTransportConfig[];
|
|
20
|
+
/** Single preset transport configuration (alternative to defaultTransports) */
|
|
21
|
+
defaultTransport?: McpTransportConfig;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Extended server information for DXT package generation and MCP server metadata
|
|
25
|
+
* This type includes logo support for MCP servers and DXT packages
|
|
26
|
+
*/
|
|
27
|
+
export type DxtServerInfo = {
|
|
28
|
+
name: string;
|
|
29
|
+
version: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
/** Author information for DXT manifest */
|
|
32
|
+
author?: {
|
|
33
|
+
name: string;
|
|
34
|
+
email?: string;
|
|
35
|
+
url?: string;
|
|
36
|
+
};
|
|
37
|
+
/** Repository information for DXT manifest */
|
|
38
|
+
repository?: {
|
|
39
|
+
type: string;
|
|
40
|
+
url: string;
|
|
41
|
+
};
|
|
42
|
+
/** License identifier for DXT manifest */
|
|
43
|
+
license?: string;
|
|
44
|
+
/** Homepage URL for DXT manifest */
|
|
45
|
+
homepage?: string;
|
|
46
|
+
/** Documentation URL for DXT manifest */
|
|
47
|
+
documentation?: string;
|
|
48
|
+
/** Support/issues URL for DXT manifest */
|
|
49
|
+
support?: string;
|
|
50
|
+
/** Keywords for DXT manifest */
|
|
51
|
+
keywords?: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Logo/icon for DXT manifest and MCP server - can be a local file path or URL
|
|
54
|
+
* This is where logo support is provided for MCP-enabled ArgParser instances
|
|
55
|
+
*/
|
|
56
|
+
logo?: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* MCP server configuration options for withMcp() method
|
|
60
|
+
* This centralizes MCP server metadata that was previously scattered across addMcpSubCommand calls
|
|
61
|
+
*/
|
|
62
|
+
export type McpServerOptions = {
|
|
63
|
+
/** MCP server metadata */
|
|
64
|
+
serverInfo?: DxtServerInfo;
|
|
65
|
+
/** Default transport configurations for the MCP server */
|
|
66
|
+
defaultTransports?: McpTransportConfig[];
|
|
67
|
+
/** Single default transport configuration (alternative to defaultTransports) */
|
|
68
|
+
defaultTransport?: McpTransportConfig;
|
|
69
|
+
/** Tool generation options for the MCP server */
|
|
70
|
+
toolOptions?: GenerateMcpToolsOptions;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Combined options for withMcp() method
|
|
74
|
+
*/
|
|
75
|
+
export type WithMcpOptions<THandlerReturn = any> = IArgParserParams<THandlerReturn> & {
|
|
76
|
+
/** MCP-specific server configuration */
|
|
77
|
+
mcp?: McpServerOptions;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Type alias for clarity - ArgParser options with MCP capabilities
|
|
81
|
+
* This provides a clearer name for WithMcpOptions
|
|
82
|
+
*/
|
|
83
|
+
export type ArgParserWithMcpOptions<THandlerReturn = any> = WithMcpOptions<THandlerReturn>;
|
|
84
|
+
/**
|
|
85
|
+
* Configuration for an individual MCP tool (deprecated - use ToolConfig instead)
|
|
86
|
+
* @deprecated Use ToolConfig and addTool() instead. Will be removed in v2.0.
|
|
87
|
+
*/
|
|
88
|
+
export type McpToolConfig = {
|
|
89
|
+
/** Tool name (must be unique within the server) */
|
|
90
|
+
name: string;
|
|
91
|
+
/** Tool description */
|
|
92
|
+
description?: string;
|
|
93
|
+
/** Input schema for the tool (Zod schema) */
|
|
94
|
+
inputSchema?: any;
|
|
95
|
+
/** Output schema for the tool (Zod schema) */
|
|
96
|
+
outputSchema?: any;
|
|
97
|
+
/** Handler function for the tool */
|
|
98
|
+
handler: (args: any) => Promise<any> | any;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Configuration for a unified tool that works in both CLI and MCP modes
|
|
102
|
+
*/
|
|
103
|
+
export type ToolConfig = {
|
|
104
|
+
/** Tool name (CLI subcommand name & MCP tool name) */
|
|
105
|
+
name: string;
|
|
106
|
+
/** Tool description */
|
|
107
|
+
description?: string;
|
|
108
|
+
/** Flags for this tool (auto-converted to MCP schema) */
|
|
109
|
+
flags: readonly IFlag[];
|
|
110
|
+
/** Handler function for the tool */
|
|
111
|
+
handler: (ctx: IHandlerContext) => Promise<any> | any;
|
|
112
|
+
/** Output schema for this tool (predefined pattern, Zod schema, or schema definition object) */
|
|
113
|
+
outputSchema?: OutputSchemaConfig;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* ArgParser with Model Context Protocol (MCP) integration capabilities.
|
|
117
|
+
*
|
|
118
|
+
* This class adds MCP server functionality on top of the standard ArgParser,
|
|
119
|
+
* allowing CLI tools to be easily exposed as MCP tools with minimal boilerplate.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* const parser = new ArgParser({
|
|
124
|
+
* appName: "My CLI",
|
|
125
|
+
* appCommandName: "my-cli",
|
|
126
|
+
* handler: async (ctx) => ({ result: "success" })
|
|
127
|
+
* })
|
|
128
|
+
* .addFlags([...])
|
|
129
|
+
* .addMcpSubCommand("serve", {
|
|
130
|
+
* name: "my-cli-mcp-server",
|
|
131
|
+
* version: "1.0.0"
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export declare class ArgParser<THandlerReturn = any> extends ArgParserBase<THandlerReturn> {
|
|
136
|
+
#private;
|
|
137
|
+
/** Stored MCP server configuration from withMcp() */
|
|
138
|
+
private _mcpServerConfig?;
|
|
139
|
+
/** Registered MCP tools (deprecated) */
|
|
140
|
+
private _mcpTools;
|
|
141
|
+
/** Registered unified tools */
|
|
142
|
+
private _tools;
|
|
143
|
+
/** Output schema management */
|
|
144
|
+
private _defaultOutputSchema?;
|
|
145
|
+
private _outputSchemaMap;
|
|
146
|
+
private _autoGenerateOutputSchema?;
|
|
147
|
+
/** MCP version for output schema compatibility */
|
|
148
|
+
private _mcpProtocolVersion;
|
|
149
|
+
/**
|
|
150
|
+
* Get the stored MCP server configuration
|
|
151
|
+
* @returns MCP server configuration if set via withMcp(), undefined otherwise
|
|
152
|
+
*/
|
|
153
|
+
getMcpServerConfig(): McpServerOptions | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Set a default output schema for all MCP tools generated from this parser
|
|
156
|
+
* @param schema - Predefined pattern name, Zod schema, or schema definition object
|
|
157
|
+
* @returns This ArgParser instance for chaining
|
|
158
|
+
*/
|
|
159
|
+
setDefaultOutputSchema(schema: OutputSchemaConfig): this;
|
|
160
|
+
/**
|
|
161
|
+
* Set an output schema for a specific tool/command
|
|
162
|
+
* @param toolName - Name of the tool/command
|
|
163
|
+
* @param schema - Predefined pattern name, Zod schema, or schema definition object
|
|
164
|
+
* @returns This ArgParser instance for chaining
|
|
165
|
+
*/
|
|
166
|
+
setOutputSchema(toolName: string, schema: OutputSchemaConfig): this;
|
|
167
|
+
/**
|
|
168
|
+
* Enable automatic output schema generation for MCP tools
|
|
169
|
+
* @param pattern - True for default pattern, or specific pattern name
|
|
170
|
+
* @returns This ArgParser instance for chaining
|
|
171
|
+
*/
|
|
172
|
+
enableAutoOutputSchema(pattern?: boolean | keyof typeof import("./types").OutputSchemaPatterns): this;
|
|
173
|
+
/**
|
|
174
|
+
* Set the MCP protocol version for compatibility checks
|
|
175
|
+
* @param version - MCP protocol version (e.g., "2025-06-18")
|
|
176
|
+
* @returns This ArgParser instance for chaining
|
|
177
|
+
*/
|
|
178
|
+
setMcpProtocolVersion(version: string): this;
|
|
179
|
+
/**
|
|
180
|
+
* Check if the current MCP protocol version supports output schemas
|
|
181
|
+
* Output schemas were introduced in MCP version 2025-06-18
|
|
182
|
+
* @returns true if output schemas are supported
|
|
183
|
+
*/
|
|
184
|
+
private supportsOutputSchemas;
|
|
185
|
+
/**
|
|
186
|
+
* Add a unified tool that works in both CLI and MCP modes
|
|
187
|
+
* In CLI mode, the tool becomes a subcommand with its own flags
|
|
188
|
+
* In MCP mode, the tool becomes an MCP tool with auto-generated schema
|
|
189
|
+
*
|
|
190
|
+
* @param toolConfig Configuration for the tool
|
|
191
|
+
* @returns This ArgParser instance for chaining
|
|
192
|
+
*/
|
|
193
|
+
addTool(toolConfig: ToolConfig): this;
|
|
194
|
+
/**
|
|
195
|
+
* Add an MCP tool to this parser (deprecated)
|
|
196
|
+
* @deprecated Use addTool() instead. This method will be removed in v2.0.
|
|
197
|
+
* @param toolConfig Configuration for the MCP tool
|
|
198
|
+
* @returns This ArgParser instance for chaining
|
|
199
|
+
*/
|
|
200
|
+
addMcpTool(toolConfig: McpToolConfig): this;
|
|
201
|
+
/**
|
|
202
|
+
* Get all registered unified tools
|
|
203
|
+
* @returns Map of tool names to tool configurations
|
|
204
|
+
*/
|
|
205
|
+
getTools(): Map<string, ToolConfig>;
|
|
206
|
+
/**
|
|
207
|
+
* Get all registered MCP tools (deprecated)
|
|
208
|
+
* @deprecated Use getTools() instead
|
|
209
|
+
* @returns Map of tool names to tool configurations
|
|
210
|
+
*/
|
|
211
|
+
getMcpTools(): Map<string, McpToolConfig>;
|
|
212
|
+
/**
|
|
213
|
+
* Get information about all available tools (unified, legacy MCP, and CLI-generated)
|
|
214
|
+
* @param options Optional configuration for MCP tool generation
|
|
215
|
+
* @returns Object with tool counts and names for debugging
|
|
216
|
+
*/
|
|
217
|
+
getToolInfo(options?: GenerateMcpToolsOptions): {
|
|
218
|
+
unifiedTools: string[];
|
|
219
|
+
legacyMcpTools: string[];
|
|
220
|
+
cliTools: string[];
|
|
221
|
+
totalTools: number;
|
|
222
|
+
duplicates: string[];
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Get information about all available MCP tools (legacy method)
|
|
226
|
+
* @deprecated Use getToolInfo() instead
|
|
227
|
+
* @param options Optional configuration for MCP tool generation
|
|
228
|
+
* @returns Object with tool counts and names for debugging
|
|
229
|
+
*/
|
|
230
|
+
getMcpToolInfo(options?: GenerateMcpToolsOptions): {
|
|
231
|
+
manualTools: string[];
|
|
232
|
+
cliTools: string[];
|
|
233
|
+
totalTools: number;
|
|
234
|
+
duplicates: string[];
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* Validate that all tools are properly registered and routable
|
|
238
|
+
* @returns Validation results
|
|
239
|
+
*/
|
|
240
|
+
validateToolRouting(): {
|
|
241
|
+
isValid: boolean;
|
|
242
|
+
issues: string[];
|
|
243
|
+
cliSubcommands: string[];
|
|
244
|
+
mcpTools: string[];
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Test tool routing by simulating a tool call
|
|
248
|
+
* This is useful for debugging and ensuring tools are properly registered
|
|
249
|
+
* @param toolName Name of the tool to test
|
|
250
|
+
* @param args Arguments to pass to the tool
|
|
251
|
+
* @returns Promise with the tool execution result or error
|
|
252
|
+
*/
|
|
253
|
+
testMcpToolRouting(toolName: string, args?: any): Promise<{
|
|
254
|
+
success: boolean;
|
|
255
|
+
result?: any;
|
|
256
|
+
error?: string;
|
|
257
|
+
executionTime?: number;
|
|
258
|
+
}>;
|
|
259
|
+
/**
|
|
260
|
+
* Generate MCP tools from this ArgParser instance
|
|
261
|
+
* @param options Optional configuration for MCP tool generation
|
|
262
|
+
* @returns Array of MCP tool structures ready for server registration
|
|
263
|
+
*/
|
|
264
|
+
toMcpTools(options?: GenerateMcpToolsOptions): IMcpToolStructure[];
|
|
265
|
+
/**
|
|
266
|
+
* Create an MCP server with tools generated from this ArgParser
|
|
267
|
+
* @param serverInfo Server configuration
|
|
268
|
+
* @param toolOptions Optional MCP tool generation options
|
|
269
|
+
* @returns Configured MCP server instance
|
|
270
|
+
*/
|
|
271
|
+
createMcpServer(serverInfo?: DxtServerInfo, toolOptions?: GenerateMcpToolsOptions): Promise<any>;
|
|
272
|
+
/**
|
|
273
|
+
* Set up change notifications for the MCP server
|
|
274
|
+
* @param _server The MCP server instance (unused for now, but reserved for future client connection tracking)
|
|
275
|
+
*/
|
|
276
|
+
private setupMcpChangeNotifications;
|
|
277
|
+
/**
|
|
278
|
+
* Start an MCP server using stdio transport
|
|
279
|
+
* @param serverInfo Server configuration
|
|
280
|
+
* @param toolOptions Optional MCP tool generation options
|
|
281
|
+
* @returns Promise that resolves when server is connected
|
|
282
|
+
*/
|
|
283
|
+
startMcpServer(serverInfo: {
|
|
284
|
+
name: string;
|
|
285
|
+
version: string;
|
|
286
|
+
description?: string;
|
|
287
|
+
}, toolOptions?: GenerateMcpToolsOptions): Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Start an MCP server with multiple transport types simultaneously
|
|
290
|
+
* @param serverInfo Server configuration
|
|
291
|
+
* @param transports Array of transport configurations
|
|
292
|
+
* @param toolOptions Optional MCP tool generation options
|
|
293
|
+
* @returns Promise that resolves when all servers are started
|
|
294
|
+
*/
|
|
295
|
+
startMcpServerWithMultipleTransports(serverInfo: {
|
|
296
|
+
name: string;
|
|
297
|
+
version: string;
|
|
298
|
+
description?: string;
|
|
299
|
+
}, transports: Array<{
|
|
300
|
+
type: "stdio" | "sse" | "streamable-http";
|
|
301
|
+
port?: number;
|
|
302
|
+
host?: string;
|
|
303
|
+
path?: string;
|
|
304
|
+
sessionIdGenerator?: () => string;
|
|
305
|
+
}>, toolOptions?: GenerateMcpToolsOptions): Promise<void>;
|
|
306
|
+
/**
|
|
307
|
+
* Start an MCP server with a specific transport type
|
|
308
|
+
* @param serverInfo Server configuration
|
|
309
|
+
* @param transportType Type of transport to use
|
|
310
|
+
* @param transportOptions Transport-specific options
|
|
311
|
+
* @param toolOptions Optional MCP tool generation options
|
|
312
|
+
* @returns Promise that resolves when server is connected
|
|
313
|
+
*/
|
|
314
|
+
startMcpServerWithTransport(serverInfo: {
|
|
315
|
+
name: string;
|
|
316
|
+
version: string;
|
|
317
|
+
description?: string;
|
|
318
|
+
}, transportType: "stdio" | "sse" | "streamable-http", transportOptions?: {
|
|
319
|
+
port?: number;
|
|
320
|
+
host?: string;
|
|
321
|
+
path?: string;
|
|
322
|
+
sessionIdGenerator?: () => string;
|
|
323
|
+
}, toolOptions?: GenerateMcpToolsOptions): Promise<void>;
|
|
324
|
+
parse(processArgs: string[], options?: any): Promise<any>;
|
|
325
|
+
/**
|
|
326
|
+
* CLI-friendly parse method that automatically handles ParseResult objects
|
|
327
|
+
* When autoExit is false, this method will call process.exit() based on ParseResult
|
|
328
|
+
* This ensures backward compatibility for CLI applications
|
|
329
|
+
*/
|
|
330
|
+
parseForCli(processArgs: string[], options?: any): any;
|
|
331
|
+
/**
|
|
332
|
+
* Alias for parse() method for backward compatibility
|
|
333
|
+
* Since parse() is already async, this just calls parse()
|
|
334
|
+
*
|
|
335
|
+
* @deprecated Use parse() instead. This method will be removed in a future version.
|
|
336
|
+
*/
|
|
337
|
+
parseAsync(processArgs: string[], options?: any): Promise<any>;
|
|
338
|
+
/**
|
|
339
|
+
* Add an MCP sub-command that starts an MCP server exposing this parser's functionality
|
|
340
|
+
* @param subCommandName Name of the sub-command (default: "mcp-server")
|
|
341
|
+
* @param serverInfo Server configuration (supports extended DXT fields)
|
|
342
|
+
* @param options Optional configuration including preset transports and tool options
|
|
343
|
+
* @returns This ArgParserWithMcp instance for chaining
|
|
344
|
+
* @deprecated Use withMcp() to configure server metadata and --s-mcp-serve system flag instead. This method will be removed in v2.0.
|
|
345
|
+
*/
|
|
346
|
+
addMcpSubCommand(subCommandName: string | undefined, serverInfo: DxtServerInfo, options?: McpSubCommandOptions & {
|
|
347
|
+
toolOptions?: GenerateMcpToolsOptions;
|
|
348
|
+
}): this;
|
|
349
|
+
/**
|
|
350
|
+
* Add an MCP sub-command that starts an MCP server exposing this parser's functionality
|
|
351
|
+
* @param subCommandName Name of the sub-command (default: "mcp-server")
|
|
352
|
+
* @param serverInfo Server configuration (supports extended DXT fields)
|
|
353
|
+
* @param toolOptions Optional MCP tool generation options (backward compatibility)
|
|
354
|
+
* @returns This ArgParserWithMcp instance for chaining
|
|
355
|
+
* @deprecated Use withMcp() to configure server metadata and --s-mcp-serve system flag instead. This method will be removed in v2.0.
|
|
356
|
+
*/
|
|
357
|
+
addMcpSubCommand(subCommandName: string | undefined, serverInfo: DxtServerInfo, toolOptions?: GenerateMcpToolsOptions): this;
|
|
358
|
+
/**
|
|
359
|
+
* Factory method to create an ArgParser instance with MCP capabilities
|
|
360
|
+
* This provides a clean API for users who want MCP functionality from the start
|
|
361
|
+
* Automatically sets handleErrors: false for MCP compatibility
|
|
362
|
+
*
|
|
363
|
+
* @param options Combined ArgParser and MCP server configuration options
|
|
364
|
+
* @param initialFlags Optional array of initial flags to add
|
|
365
|
+
* @returns ArgParser instance with MCP capabilities and stored server metadata
|
|
366
|
+
*/
|
|
367
|
+
static withMcp<T = any>(options?: WithMcpOptions<T>, initialFlags?: readonly IFlag[]): ArgParser<T>;
|
|
368
|
+
/**
|
|
369
|
+
* Create an ArgParser instance optimized for CLI usage
|
|
370
|
+
* This sets autoExit: true by default for traditional CLI behavior
|
|
371
|
+
*/
|
|
372
|
+
static forCli<T = any>(options?: ConstructorParameters<typeof ArgParserBase>[0], initialFlags?: ConstructorParameters<typeof ArgParserBase>[1]): ArgParser<T>;
|
|
373
|
+
/**
|
|
374
|
+
* Create an ArgParser instance optimized for library usage
|
|
375
|
+
* This sets autoExit: false by default for programmatic control
|
|
376
|
+
*/
|
|
377
|
+
static forLibrary<T = any>(options?: ConstructorParameters<typeof ArgParserBase>[0], initialFlags?: ConstructorParameters<typeof ArgParserBase>[1]): ArgParser<T>;
|
|
378
|
+
static fromArgParser<T = any>(parser: ArgParserBase<T>): ArgParser<T>;
|
|
379
|
+
}
|
|
380
|
+
//# sourceMappingURL=ArgParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArgParser.d.ts","sourceRoot":"","sources":["../../src/core/ArgParser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAGjB;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,iBAAiB,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACzC,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,MAAM,MA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AS,CAAC,CAAC,CAAC;IAoBf;;;OAGG;WACW,MAAM,CAAC,CAAC,GAAG,GAAG,EAC1B,OAAO,CAAC,EAAE,qBAAqB,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,EACxD,YAAY,CAAC,EAAE,qBAAqB,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,GAC5D,SAAS,CAAC,CAAC,CAAC;IASf;;;OAGG;WACW,UAAU,CAAC,CAAC,GAAG,GAAG,EAC9B,OAAO,CAAC,EAAE,qBAAqB,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,EACxD,YAAY,CAAC,EAAE,qBAAqB,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,GAC5D,SAAS,CAAC,CAAC,CAAC;WASD,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;CA+B7E"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { McpChangeType, McpNotificationsManager } from "../mcp/mcp-notifications.js";
|
|
2
|
+
import { McpPromptConfig, McpPromptsManager } from "../mcp/mcp-prompts.js";
|
|
3
|
+
import { McpResourceConfig, McpResourcesManager } from "../mcp/mcp-resources.js";
|
|
4
|
+
import type { IFlag, IHandlerContext, ISubCommand, ParseResult, ProcessedFlag, TParsedArgs } from "./types";
|
|
5
|
+
export declare class ArgParserError extends Error {
|
|
6
|
+
cmdChain: string[];
|
|
7
|
+
commandChain: string[];
|
|
8
|
+
constructor(message: string, cmdChain?: string[]);
|
|
9
|
+
}
|
|
10
|
+
export interface IArgParserParams<THandlerReturn = any> {
|
|
11
|
+
/**
|
|
12
|
+
* This is the display name of the app, used in help text
|
|
13
|
+
*/
|
|
14
|
+
appName?: string;
|
|
15
|
+
subCommands?: ISubCommand[];
|
|
16
|
+
handler?: (ctx: IHandlerContext<any, any>) => THandlerReturn | Promise<THandlerReturn>;
|
|
17
|
+
/**
|
|
18
|
+
* Add an extra new line between each flag group,
|
|
19
|
+
* makes the text more readable but uses more space
|
|
20
|
+
*
|
|
21
|
+
* Default: true
|
|
22
|
+
*/
|
|
23
|
+
extraNewLine?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Wraps the line at width, if shorter, wrapping will be more
|
|
26
|
+
* aggressive. Wrapping is based on words.
|
|
27
|
+
*
|
|
28
|
+
* Default: 50
|
|
29
|
+
* Minimum: 30
|
|
30
|
+
*/
|
|
31
|
+
wrapAtWidth?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Controls the placing of right text on the screen.
|
|
34
|
+
* The higher the value, the more to the right the text will be.
|
|
35
|
+
*
|
|
36
|
+
* Default: 30
|
|
37
|
+
* Minimum: 20
|
|
38
|
+
*/
|
|
39
|
+
blankSpaceWidth?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Character to display next to the flag to express mandatory fields.
|
|
42
|
+
*
|
|
43
|
+
* Default: *
|
|
44
|
+
*/
|
|
45
|
+
mandatoryCharacter?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Throw an error if a flag is added more than once
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
throwForDuplicateFlags?: boolean;
|
|
51
|
+
description?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Automatically handle ArgParserErrors by printing a formatted message
|
|
54
|
+
* and exiting. Set to false to catch ArgParserError manually.
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
handleErrors?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to automatically call process.exit() based on ParseResult.
|
|
60
|
+
* When true (default), maintains backward compatibility with CLI behavior.
|
|
61
|
+
* When false, returns ParseResult objects for programmatic use.
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
64
|
+
autoExit?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The command name to display in help suggestions (e.g., 'dabl').
|
|
67
|
+
* If not provided, it falls back to guessing from the script path.
|
|
68
|
+
*/
|
|
69
|
+
appCommandName?: string;
|
|
70
|
+
/**
|
|
71
|
+
* If true, when this parser is added as a sub-command, it will inherit
|
|
72
|
+
* flags from its direct parent *unless* a flag with the same name
|
|
73
|
+
* already exists in this parser. Child flags take precedence.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
inheritParentFlags?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface IParseOptions {
|
|
79
|
+
/**
|
|
80
|
+
* When true, skips help flag processing (doesn't exit or show help)
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
skipHelpHandling?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* When true, skips the execution of any command handlers.
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
skipHandlers?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* When true (default), automatically awaits async handlers before returning.
|
|
91
|
+
* When false, returns immediately with _asyncHandlerPromise for manual handling.
|
|
92
|
+
* @default true
|
|
93
|
+
*/
|
|
94
|
+
deep?: boolean;
|
|
95
|
+
}
|
|
96
|
+
type TParsedArgsWithRouting<T = any> = T & {
|
|
97
|
+
$commandChain?: string[];
|
|
98
|
+
handlerToExecute?: {
|
|
99
|
+
handler: Function;
|
|
100
|
+
context: IHandlerContext;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export declare class ArgParserBase<THandlerReturn = any> {
|
|
104
|
+
#private;
|
|
105
|
+
constructor(options?: IArgParserParams<THandlerReturn>, initialFlags?: readonly IFlag[]);
|
|
106
|
+
get flags(): ProcessedFlag[];
|
|
107
|
+
get flagNames(): string[];
|
|
108
|
+
getAppName(): string | undefined;
|
|
109
|
+
getAppCommandName(): string | undefined;
|
|
110
|
+
getSubCommandName(): string;
|
|
111
|
+
getDescription(): string | undefined;
|
|
112
|
+
getAutoExit(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Helper method to handle exit logic based on autoExit setting
|
|
115
|
+
* Returns a ParseResult instead of calling process.exit() when autoExit is false
|
|
116
|
+
*/
|
|
117
|
+
private _handleExit;
|
|
118
|
+
getHandler(): ((ctx: IHandlerContext) => void) | undefined;
|
|
119
|
+
getSubCommands(): Map<string, ISubCommand>;
|
|
120
|
+
private _addToOutput;
|
|
121
|
+
addFlags(flags: readonly IFlag[]): this;
|
|
122
|
+
addFlag(flag: IFlag): this;
|
|
123
|
+
addSubCommand(subCommandConfig: ISubCommand): this;
|
|
124
|
+
/**
|
|
125
|
+
* Sets the handler function for this specific parser instance.
|
|
126
|
+
* This handler will be executed if this parser is the final one
|
|
127
|
+
* in the command chain and `executeHandlers` is enabled on the root parser.
|
|
128
|
+
*
|
|
129
|
+
* @param handler - The function to execute.
|
|
130
|
+
* @returns The ArgParser instance for chaining.
|
|
131
|
+
*/
|
|
132
|
+
setHandler(handler: (ctx: IHandlerContext<any, any>) => THandlerReturn | Promise<THandlerReturn>): this;
|
|
133
|
+
printAll(filePath?: string): void;
|
|
134
|
+
parse(processArgs: string[], options?: IParseOptions): Promise<TParsedArgsWithRouting<any> | ParseResult>;
|
|
135
|
+
/**
|
|
136
|
+
* Alias for parse() method for backward compatibility
|
|
137
|
+
* Since parse() is already async, this just calls parse()
|
|
138
|
+
*
|
|
139
|
+
* @deprecated Use parse() instead. This method will be removed in a future version.
|
|
140
|
+
*/
|
|
141
|
+
parseAsync(processArgs: string[], options?: IParseOptions): Promise<TParsedArgsWithRouting<any> | ParseResult>;
|
|
142
|
+
/**
|
|
143
|
+
* Recursive helper for parsing arguments and handling sub-commands.
|
|
144
|
+
* This method assumes the global help check has already been performed in `parse`.
|
|
145
|
+
*/
|
|
146
|
+
private _parseRecursive;
|
|
147
|
+
helpText(): string;
|
|
148
|
+
getSubCommand(name: string): ISubCommand | undefined;
|
|
149
|
+
hasFlag(name: string): boolean;
|
|
150
|
+
getCommandChain(): string[];
|
|
151
|
+
getLastParseResult(): TParsedArgs<ProcessedFlag[]>;
|
|
152
|
+
/**
|
|
153
|
+
* Add an MCP resource to this parser
|
|
154
|
+
*/
|
|
155
|
+
addMcpResource(config: McpResourceConfig): this;
|
|
156
|
+
/**
|
|
157
|
+
* Remove an MCP resource by name
|
|
158
|
+
*/
|
|
159
|
+
removeMcpResource(name: string): this;
|
|
160
|
+
/**
|
|
161
|
+
* Get all registered MCP resources
|
|
162
|
+
*/
|
|
163
|
+
getMcpResources(): McpResourceConfig[];
|
|
164
|
+
/**
|
|
165
|
+
* Add an MCP prompt to this parser
|
|
166
|
+
*/
|
|
167
|
+
addMcpPrompt(config: McpPromptConfig): this;
|
|
168
|
+
/**
|
|
169
|
+
* Remove an MCP prompt by name
|
|
170
|
+
*/
|
|
171
|
+
removeMcpPrompt(name: string): this;
|
|
172
|
+
/**
|
|
173
|
+
* Get all registered MCP prompts
|
|
174
|
+
*/
|
|
175
|
+
getMcpPrompts(): McpPromptConfig[];
|
|
176
|
+
/**
|
|
177
|
+
* Add a change listener for MCP entities
|
|
178
|
+
*/
|
|
179
|
+
onMcpChange(listener: (event: {
|
|
180
|
+
type: McpChangeType;
|
|
181
|
+
action: string;
|
|
182
|
+
entityName?: string;
|
|
183
|
+
}) => void): this;
|
|
184
|
+
/**
|
|
185
|
+
* Remove a change listener for MCP entities
|
|
186
|
+
*/
|
|
187
|
+
offMcpChange(listener: (event: {
|
|
188
|
+
type: McpChangeType;
|
|
189
|
+
action: string;
|
|
190
|
+
entityName?: string;
|
|
191
|
+
}) => void): this;
|
|
192
|
+
/**
|
|
193
|
+
* Get the MCP notifications manager (for advanced usage)
|
|
194
|
+
*/
|
|
195
|
+
getMcpNotificationsManager(): McpNotificationsManager;
|
|
196
|
+
/**
|
|
197
|
+
* Get the MCP resources manager (for advanced usage)
|
|
198
|
+
*/
|
|
199
|
+
getMcpResourcesManager(): McpResourcesManager;
|
|
200
|
+
/**
|
|
201
|
+
* Get the MCP prompts manager (for advanced usage)
|
|
202
|
+
*/
|
|
203
|
+
getMcpPromptsManager(): McpPromptsManager;
|
|
204
|
+
}
|
|
205
|
+
export {};
|
|
206
|
+
//# sourceMappingURL=ArgParserBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArgParserBase.d.ts","sourceRoot":"","sources":["../../src/core/ArgParserBase.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,aAAa,EACb,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,WAAW,EACX,WAAW,EACX,aAAa,EACb,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,qBAAa,cAAe,SAAQ,KAAK;IAI9B,QAAQ,EAAE,MAAM,EAAE;IAHpB,YAAY,EAAE,MAAM,EAAE,CAAC;gBAE5B,OAAO,EAAE,MAAM,EACR,QAAQ,GAAE,MAAM,EAAO;CAMjC;AAED,MAAM,WAAW,gBAAgB,CAAC,cAAc,GAAG,GAAG;IACpD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,CACR,GAAG,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,KAC3B,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE9C;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,C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,CAAC,KAAK,EAAE;QAChB,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,KAAK,IAAI,GACT,IAAI;IAKP;;OAEG;IACH,YAAY,CACV,QAAQ,EAAE,CAAC,KAAK,EAAE;QAChB,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,KAAK,IAAI,GACT,IAAI;IAKP;;OAEG;IACH,0BAA0B,IAAI,uBAAuB;IAIrD;;OAEG;IACH,sBAAsB,IAAI,mBAAmB;IAI7C;;OAEG;IACH,oBAAoB,IAAI,iBAAiB;CAiY1C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IFlag, ProcessedFlag } from "./types";
|
|
2
|
+
export declare class FlagManager {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(options?: {
|
|
5
|
+
throwForDuplicateFlags?: boolean;
|
|
6
|
+
}, initialFlags?: readonly IFlag[]);
|
|
7
|
+
static _safeFlag(flag: IFlag): ProcessedFlag;
|
|
8
|
+
addFlag(flag: IFlag): this;
|
|
9
|
+
_setProcessedFlagForInheritance(processedFlag: ProcessedFlag): this;
|
|
10
|
+
addFlags(flags: readonly IFlag[]): this;
|
|
11
|
+
hasFlag(name: string): boolean;
|
|
12
|
+
getFlag(name: string): ProcessedFlag | undefined;
|
|
13
|
+
get flags(): ProcessedFlag[];
|
|
14
|
+
get flagNames(): string[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=FlagManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlagManager.d.ts","sourceRoot":"","sources":["../../src/core/FlagManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEpD,qBAAa,WAAW;;gBAKpB,OAAO,GAAE;QAAE,sBAAsB,CAAC,EAAE,OAAO,CAAA;KAAO,EAClD,YAAY,GAAE,SAAS,KAAK,EAAO;IAMrC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,GAAG,aAAa;IAwC5C,OAAO,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI;IAoB1B,+BAA+B,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI;IAQnE,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,GAAG,IAAI;IAOvC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI9B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAIhD,IAAI,KAAK,IAAI,aAAa,EAAE,CAE3B;IAED,IAAI,SAAS,IAAI,MAAM,EAAE,CAExB;CACF"}
|