@alcyone-labs/arg-parser 1.2.0 → 2.1.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alcyone-labs/arg-parser",
3
- "version": "1.2.0",
4
- "description": "A robust, type-safe command line argument parser with automatic type inference, validation, help generation and complex sub-command support, now with built-in MCP, DXT and fuzzy testing support.",
3
+ "version": "2.1.0",
4
+ "description": "A robust, type-safe command line argument parser with plugin architecture, dependency injection, Claude Desktop compliant MCP integration, autonomous DXT builds, and zero-dependency core functionality.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -26,6 +26,7 @@
26
26
  "dist/index.min.mjs.map",
27
27
  "dist/src/**/*.d.ts",
28
28
  "dist/src/**/*.d.ts.map",
29
+ "dist/assets/**/*",
29
30
  "README.md",
30
31
  "LICENSE"
31
32
  ],
@@ -44,29 +45,32 @@
44
45
  ],
45
46
  "author": "Nicolas Embleton <nicolas.embleton@gmail.com>",
46
47
  "license": "MIT",
48
+ "engines": {
49
+ "node": ">=18.0.0"
50
+ },
47
51
  "dependencies": {
48
- "@iarna/toml": "^2.2.5",
49
- "adm-zip": "^0.5.16",
50
- "chalk": "^5.4.1",
51
- "dotenv": "^16.5.0",
52
- "js-yaml": "^4.1.0",
52
+ "@alcyone-labs/simple-chalk": "^1.0.1",
53
+ "@alcyone-labs/simple-mcp-logger": "^1.1.0",
53
54
  "magic-regexp": "^0.10.0",
54
- "node-fetch": "^3.3.2",
55
- "zod": "^3.25.67"
55
+ "zod": "^3.25.76"
56
56
  },
57
57
  "optionalDependencies": {
58
- "@modelcontextprotocol/sdk": "^1.13.1",
59
- "express": "^5.1.0"
58
+ "@modelcontextprotocol/sdk": "^1.15.1",
59
+ "dotenv": "^16.6.1",
60
+ "express": "^5.1.0",
61
+ "js-yaml": "^4.1.0",
62
+ "smol-toml": "^1.4.1",
63
+ "tsdown": "^0.12.9"
60
64
  },
61
65
  "devDependencies": {
62
- "@ianvs/prettier-plugin-sort-imports": "^4.4.2",
66
+ "@ianvs/prettier-plugin-sort-imports": "^4.5.1",
63
67
  "@types/adm-zip": "^0.5.7",
64
68
  "@types/express": "^5.0.3",
65
69
  "@types/js-yaml": "^4.0.9",
66
- "@types/node": "^22.15.33",
70
+ "@types/node": "^22.16.3",
67
71
  "cross-env": "^7.0.3",
68
72
  "madge": "^8.0.0",
69
- "prettier": "^3.6.1",
73
+ "prettier": "^3.6.2",
70
74
  "ts-node": "^10.9.2",
71
75
  "typescript": "^5.8.3",
72
76
  "vite": "^6.3.5",
@@ -79,7 +83,8 @@
79
83
  "build:cjs": "cross-env VITE_BUILD_FORMAT=cjs vite build",
80
84
  "build:esm": "cross-env VITE_BUILD_FORMAT=es VITE_MINIFY_BUILD=false vite build",
81
85
  "build:min": "cross-env VITE_BUILD_FORMAT=es VITE_MINIFY_BUILD=true vite build",
82
- "build": "pnpm clean && pnpm run build:types && pnpm run build:cjs && pnpm run build:esm && pnpm run build:min",
86
+ "build": "pnpm clean && pnpm run build:types && pnpm run build:cjs && pnpm run build:esm && pnpm run build:min && pnpm run build:assets",
87
+ "build:assets": "mkdir -p dist/assets && cp docs/MCP/icons/logo_1_small.jpg dist/assets/ && cp tsdown.dxt.config.ts dist/assets/ && cp .dxtignore.template dist/assets/",
83
88
  "build:watch": "tsc --watch",
84
89
  "build:examples": "tsc --project tsconfig.examples.json",
85
90
  "test:watch": "vitest",
@@ -88,13 +93,26 @@
88
93
  "test:mcp": "bun tests/mcp/integration/run-integration-tests.ts",
89
94
  "test:mcp:verbose": "bun tests/mcp/integration/run-integration-tests.ts --verbose",
90
95
  "test:mcp:e2e": "bun tests/mcp/integration/run-integration-tests.ts --suite end-to-end",
91
- "test:mcp:compliance": "bun tests/mcp/integration/run-integration-tests.ts --suite protocol-compliance",
96
+ "test:mcp:protocol": "bun tests/mcp/integration/run-integration-tests.ts --suite protocol-compliance",
92
97
  "test:mcp:performance": "bun tests/mcp/integration/run-integration-tests.ts --suite performance",
93
98
  "test:mcp:canny": "bun tests/mcp/integration/run-integration-tests.ts --suite canny-cli",
99
+ "test:mcp:compliance": "vitest run tests/mcp/compliance/",
100
+ "test:mcp:dxt": "vitest run tests/mcp/compliance/dxt-compliance.test.ts",
94
101
  "format": "prettier . --write",
95
102
  "check:cir-dep": "madge ./ -c --ts-config tsconfig.dev.json",
96
103
  "check:types": "tsc --project ./tsconfig.dev.json --noEmit",
97
104
  "build:checks": "pnpm check:cir-dep && pnpm check:types",
98
- "test:built": "node test-built-library.mjs"
105
+ "test:built": "node test-built-library.mjs",
106
+ "test:post-publish": "node scripts/post-publish-validation.mjs",
107
+ "test:post-publish:mcp": "node scripts/post-publish-mcp-validation.mjs",
108
+ "test:post-publish:all": "pnpm test:post-publish && pnpm test:post-publish:mcp",
109
+ "validate:v2": "node scripts/validate-v2.mjs",
110
+ "tsdown:dxt": "tsdown -c tsdown.dxt.config.ts",
111
+ "dxt:validate": "npx @anthropic-ai/dxt validate",
112
+ "dxt:info": "npx @anthropic-ai/dxt info",
113
+ "dxt:sign": "npx @anthropic-ai/dxt sign --self-signed",
114
+ "dxt:pack": "npx @anthropic-ai/dxt pack",
115
+ "dxt:unpack": "npx @anthropic-ai/dxt unpack",
116
+ "dxt:verify": "npx @anthropic-ai/dxt verify"
99
117
  }
100
118
  }
@@ -1,148 +0,0 @@
1
- import { ArgParserBase } from "./ArgParserBase";
2
- import type { GenerateMcpToolsOptions, IMcpToolStructure } from "./mcp-integration";
3
- /**
4
- * Configuration for a single MCP transport
5
- */
6
- export type McpTransportConfig = {
7
- type: "stdio" | "sse" | "streamable-http";
8
- port?: number;
9
- host?: string;
10
- path?: string;
11
- sessionIdGenerator?: () => string;
12
- };
13
- /**
14
- * Configuration options for MCP sub-command
15
- */
16
- export type McpSubCommandOptions = {
17
- /** Preset transport configurations to use when no CLI flags are provided */
18
- defaultTransports?: McpTransportConfig[];
19
- /** Single preset transport configuration (alternative to defaultTransports) */
20
- defaultTransport?: McpTransportConfig;
21
- };
22
- /**
23
- * ArgParser with Model Context Protocol (MCP) integration capabilities.
24
- *
25
- * This class adds MCP server functionality on top of the standard ArgParser,
26
- * allowing CLI tools to be easily exposed as MCP tools with minimal boilerplate.
27
- *
28
- * @example
29
- * ```typescript
30
- * const parser = new ArgParser({
31
- * appName: "My CLI",
32
- * appCommandName: "my-cli",
33
- * handler: async (ctx) => ({ result: "success" })
34
- * })
35
- * .addFlags([...])
36
- * .addMcpSubCommand("serve", {
37
- * name: "my-cli-mcp-server",
38
- * version: "1.0.0"
39
- * });
40
- * ```
41
- */
42
- export declare class ArgParser<THandlerReturn = any> extends ArgParserBase<THandlerReturn> {
43
- #private;
44
- /**
45
- * Generate MCP tools from this ArgParser instance
46
- * @param options Optional configuration for MCP tool generation
47
- * @returns Array of MCP tool structures ready for server registration
48
- */
49
- toMcpTools(options?: GenerateMcpToolsOptions): IMcpToolStructure[];
50
- /**
51
- * Create an MCP server with tools generated from this ArgParser
52
- * @param serverInfo Server configuration
53
- * @param toolOptions Optional MCP tool generation options
54
- * @returns Configured MCP server instance
55
- */
56
- createMcpServer(serverInfo: {
57
- name: string;
58
- version: string;
59
- description?: string;
60
- }, toolOptions?: GenerateMcpToolsOptions): Promise<any>;
61
- /**
62
- * Start an MCP server using stdio transport
63
- * @param serverInfo Server configuration
64
- * @param toolOptions Optional MCP tool generation options
65
- * @returns Promise that resolves when server is connected
66
- */
67
- startMcpServer(serverInfo: {
68
- name: string;
69
- version: string;
70
- description?: string;
71
- }, toolOptions?: GenerateMcpToolsOptions): Promise<void>;
72
- /**
73
- * Start an MCP server with multiple transport types simultaneously
74
- * @param serverInfo Server configuration
75
- * @param transports Array of transport configurations
76
- * @param toolOptions Optional MCP tool generation options
77
- * @returns Promise that resolves when all servers are started
78
- */
79
- startMcpServerWithMultipleTransports(serverInfo: {
80
- name: string;
81
- version: string;
82
- description?: string;
83
- }, transports: Array<{
84
- type: "stdio" | "sse" | "streamable-http";
85
- port?: number;
86
- host?: string;
87
- path?: string;
88
- sessionIdGenerator?: () => string;
89
- }>, toolOptions?: GenerateMcpToolsOptions): Promise<void>;
90
- /**
91
- * Start an MCP server with a specific transport type
92
- * @param serverInfo Server configuration
93
- * @param transportType Type of transport to use
94
- * @param transportOptions Transport-specific options
95
- * @param toolOptions Optional MCP tool generation options
96
- * @returns Promise that resolves when server is connected
97
- */
98
- startMcpServerWithTransport(serverInfo: {
99
- name: string;
100
- version: string;
101
- description?: string;
102
- }, transportType: "stdio" | "sse" | "streamable-http", transportOptions?: {
103
- port?: number;
104
- host?: string;
105
- path?: string;
106
- sessionIdGenerator?: () => string;
107
- }, toolOptions?: GenerateMcpToolsOptions): Promise<void>;
108
- parse(processArgs: string[], options?: any): any;
109
- /**
110
- * Async version of parse for when async handlers are detected
111
- */
112
- parseAsync(processArgs: string[], options?: any): Promise<any>;
113
- /**
114
- * Add an MCP sub-command that starts an MCP server exposing this parser's functionality
115
- * @param subCommandName Name of the sub-command (default: "mcp-server")
116
- * @param serverInfo Server configuration
117
- * @param options Optional configuration including preset transports and tool options
118
- * @returns This ArgParserWithMcp instance for chaining
119
- */
120
- addMcpSubCommand(subCommandName: string | undefined, serverInfo: {
121
- name: string;
122
- version: string;
123
- description?: string;
124
- }, options?: McpSubCommandOptions & {
125
- toolOptions?: GenerateMcpToolsOptions;
126
- }): this;
127
- /**
128
- * Add an MCP sub-command that starts an MCP server exposing this parser's functionality
129
- * @param subCommandName Name of the sub-command (default: "mcp-server")
130
- * @param serverInfo Server configuration
131
- * @param toolOptions Optional MCP tool generation options (backward compatibility)
132
- * @returns This ArgParserWithMcp instance for chaining
133
- * @deprecated Use the options parameter instead for better configurability
134
- */
135
- addMcpSubCommand(subCommandName: string | undefined, serverInfo: {
136
- name: string;
137
- version: string;
138
- description?: string;
139
- }, toolOptions?: GenerateMcpToolsOptions): this;
140
- /**
141
- * Factory method to create an ArgParser instance with MCP capabilities
142
- * This provides a clean API for users who want MCP functionality from the start
143
- * Automatically sets handleErrors: false for MCP compatibility
144
- */
145
- static withMcp<T = any>(options?: ConstructorParameters<typeof ArgParserBase>[0], initialFlags?: ConstructorParameters<typeof ArgParserBase>[1]): ArgParser<T>;
146
- static fromArgParser<T = any>(parser: ArgParserBase<T>): ArgParser<T>;
147
- }
148
- //# sourceMappingURL=ArgParser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ArgParser.d.ts","sourceRoot":"","sources":["../../src/ArgParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,KAAK,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGpF;;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;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,SAAS,CACpB,cAAc,GAAG,GAAG,CACpB,SAAQ,aAAa,CAAC,cAAc,CAAC;;IACrC;;;;OAIG;IACI,UAAU,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,iBAAiB,EAAE;IAIzE;;;;;OAKG;IACU,eAAe,CAC1B,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,M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E,OAAO,CAAC,EAAE,GAAG,GAAG,GAAG;IAevD;;OAEG;IACU,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAsC3E;;;;;;OAMG;IACI,gBAAgB,CACrB,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,EACD,OAAO,CAAC,EAAE,oBAAoB,GAAG;QAAE,WAAW,CAAC,EAAE,uBAAuB,CAAA;KAAE,GACzE,IAAI;IAEP;;;;;;;OAOG;IACI,gBAAgB,CACrB,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,EACD,WAAW,CAAC,EAAE,uBAAuB,GACpC,IAAI;IAyIP;;;;OAIG;WACW,OAAO,CAAC,CAAC,GAAG,GAAG,EAC3B,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;WAUD,aAAa,CAAC,CAAC,GAAG,GAAG,EACjC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GACvB,SAAS,CAAC,CAAC,CAAC;CA+BhB"}
@@ -1,125 +0,0 @@
1
- import type { IFlag, IHandlerContext, ISubCommand, ProcessedFlag, TParsedArgs } from "./types";
2
- export declare class ArgParserError extends Error {
3
- cmdChain: string[];
4
- commandChain: string[];
5
- constructor(message: string, cmdChain?: string[]);
6
- }
7
- export interface IArgParserParams<THandlerReturn = any> {
8
- /**
9
- * This is the display name of the app, used in help text
10
- */
11
- appName?: string;
12
- subCommands?: ISubCommand[];
13
- handler?: (ctx: IHandlerContext<any, any>) => THandlerReturn | Promise<THandlerReturn>;
14
- /**
15
- * Add an extra new line between each flag group,
16
- * makes the text more readable but uses more space
17
- *
18
- * Default: true
19
- */
20
- extraNewLine?: boolean;
21
- /**
22
- * Wraps the line at width, if shorter, wrapping will be more
23
- * aggressive. Wrapping is based on words.
24
- *
25
- * Default: 50
26
- * Minimum: 30
27
- */
28
- wrapAtWidth?: number;
29
- /**
30
- * Controls the placing of right text on the screen.
31
- * The higher the value, the more to the right the text will be.
32
- *
33
- * Default: 30
34
- * Minimum: 20
35
- */
36
- blankSpaceWidth?: number;
37
- /**
38
- * Character to display next to the flag to express mandatory fields.
39
- *
40
- * Default: *
41
- */
42
- mandatoryCharacter?: string;
43
- /**
44
- * Throw an error if a flag is added more than once
45
- * @default false
46
- */
47
- throwForDuplicateFlags?: boolean;
48
- description?: string;
49
- /**
50
- * Automatically handle ArgParserErrors by printing a formatted message
51
- * and exiting. Set to false to catch ArgParserError manually.
52
- * @default true
53
- */
54
- handleErrors?: boolean;
55
- /**
56
- * The command name to display in help suggestions (e.g., 'dabl').
57
- * If not provided, it falls back to guessing from the script path.
58
- */
59
- appCommandName?: string;
60
- /**
61
- * If true, when this parser is added as a sub-command, it will inherit
62
- * flags from its direct parent *unless* a flag with the same name
63
- * already exists in this parser. Child flags take precedence.
64
- * @default false
65
- */
66
- inheritParentFlags?: boolean;
67
- }
68
- interface IParseOptions {
69
- /**
70
- * When true, skips help flag processing (doesn't exit or show help)
71
- * @default false
72
- */
73
- skipHelpHandling?: boolean;
74
- /**
75
- * When true, skips the execution of any command handlers.
76
- * @default false
77
- */
78
- skipHandlers?: boolean;
79
- }
80
- type TParsedArgsWithRouting<T = any> = T & {
81
- $commandChain?: string[];
82
- handlerToExecute?: {
83
- handler: Function;
84
- context: IHandlerContext;
85
- };
86
- };
87
- export declare class ArgParserBase<THandlerReturn = any> {
88
- #private;
89
- constructor(options?: IArgParserParams<THandlerReturn>, initialFlags?: readonly IFlag[]);
90
- get flags(): ProcessedFlag[];
91
- get flagNames(): string[];
92
- getAppName(): string | undefined;
93
- getAppCommandName(): string | undefined;
94
- getSubCommandName(): string;
95
- getDescription(): string | undefined;
96
- getHandler(): ((ctx: IHandlerContext) => void) | undefined;
97
- getSubCommands(): Map<string, ISubCommand>;
98
- private _addToOutput;
99
- addFlags(flags: readonly IFlag[]): this;
100
- addFlag(flag: IFlag): this;
101
- addSubCommand(subCommandConfig: ISubCommand): this;
102
- /**
103
- * Sets the handler function for this specific parser instance.
104
- * This handler will be executed if this parser is the final one
105
- * in the command chain and `executeHandlers` is enabled on the root parser.
106
- *
107
- * @param handler - The function to execute.
108
- * @returns The ArgParser instance for chaining.
109
- */
110
- setHandler(handler: (ctx: IHandlerContext<any, any>) => THandlerReturn | Promise<THandlerReturn>): this;
111
- printAll(filePath?: string): void;
112
- parse(processArgs: string[], options?: IParseOptions): TParsedArgsWithRouting<any>;
113
- /**
114
- * Recursive helper for parsing arguments and handling sub-commands.
115
- * This method assumes the global help check has already been performed in `parse`.
116
- */
117
- private _parseRecursive;
118
- helpText(): string;
119
- getSubCommand(name: string): ISubCommand | undefined;
120
- hasFlag(name: string): boolean;
121
- getCommandChain(): string[];
122
- getLastParseResult(): TParsedArgs<ProcessedFlag[]>;
123
- }
124
- export {};
125
- //# sourceMappingURL=ArgParserBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ArgParserBase.d.ts","sourceRoot":"","sources":["../../src/ArgParserBase.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,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,M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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
@@ -1 +0,0 @@
1
- {"version":3,"file":"FlagManager.d.ts","sourceRoot":"","sources":["../../src/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"}
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import { ArgParser } from "./ArgParser";
3
- declare const fuzzyTestCli: ArgParser<void>;
4
- export { fuzzyTestCli };
5
- //# sourceMappingURL=fuzzy-test-cli.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fuzzy-test-cli.d.ts","sourceRoot":"","sources":["../../src/fuzzy-test-cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgBxC,QAAA,MAAM,YAAY,iBAmEhB,CAAC;AAkPH,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,101 +0,0 @@
1
- import type { ArgParserBase } from "./ArgParserBase";
2
- export interface FuzzyTestOptions {
3
- /** Maximum depth for command path exploration */
4
- maxDepth?: number;
5
- /** Number of random test cases to generate per command path */
6
- randomTestCases?: number;
7
- /** Include performance timing in results */
8
- includePerformance?: boolean;
9
- /** Test invalid combinations to verify error handling */
10
- testErrorCases?: boolean;
11
- /** Verbose output for debugging */
12
- verbose?: boolean;
13
- }
14
- export interface TestResult {
15
- commandPath: string[];
16
- args: string[];
17
- success: boolean;
18
- error?: string;
19
- executionTime?: number;
20
- parsedResult?: any;
21
- }
22
- export interface FuzzyTestReport {
23
- totalTests: number;
24
- successfulTests: number;
25
- failedTests: number;
26
- commandPaths: string[][];
27
- results: TestResult[];
28
- summary: {
29
- coverageByPath: Record<string, {
30
- total: number;
31
- passed: number;
32
- }>;
33
- errorTypes: Record<string, number>;
34
- };
35
- }
36
- export declare class ArgParserFuzzyTester {
37
- private parser;
38
- private options;
39
- constructor(parser: ArgParserBase, options?: FuzzyTestOptions);
40
- /**
41
- * Run comprehensive fuzzy testing on the ArgParser instance
42
- */
43
- runFuzzyTest(): Promise<FuzzyTestReport>;
44
- /**
45
- * Discover all possible command paths in the parser
46
- */
47
- private discoverCommandPaths;
48
- /**
49
- * Recursively discover subcommand paths
50
- */
51
- private discoverSubCommandPaths;
52
- /**
53
- * Get subcommands from a parser instance
54
- */
55
- private getSubCommands;
56
- /**
57
- * Get flags from a parser instance
58
- */
59
- private getFlags;
60
- /**
61
- * Test a specific command path with various flag combinations
62
- */
63
- private testCommandPath;
64
- /**
65
- * Get the parser instance for a specific command path
66
- */
67
- private getParserForPath;
68
- /**
69
- * Generate valid flag combinations for testing
70
- */
71
- private generateValidFlagCombinations;
72
- /**
73
- * Generate random flag combination
74
- */
75
- private generateRandomFlagCombination;
76
- /**
77
- * Generate error test cases
78
- */
79
- private generateErrorCases;
80
- /**
81
- * Generate arguments for a specific flag
82
- */
83
- private generateFlagArgs;
84
- /**
85
- * Generate values for a flag based on its type and constraints
86
- */
87
- private generateFlagValues;
88
- /**
89
- * Generate a single value for a flag
90
- */
91
- private generateSingleFlagValue;
92
- /**
93
- * Execute a single test case
94
- */
95
- private executeTest;
96
- /**
97
- * Generate comprehensive test report
98
- */
99
- private generateReport;
100
- }
101
- //# sourceMappingURL=fuzzy-tester.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fuzzy-tester.d.ts","sourceRoot":"","sources":["../../src/fuzzy-tester.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,WAAW,gBAAgB;IAC/B,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,yDAAyD;IACzD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mCAAmC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;IACzB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACpC,CAAC;CACH;AAED,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAA6B;gBAEhC,MAAM,EAAE,aAAa,EAAE,OAAO,GAAE,gBAAqB;IAWjE;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,eAAe,CAAC;IAiB9C;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAY5B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAmB/B;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAIhB;;OAEG;YACW,eAAe;IAsC7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAexB;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAqDrC;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAerC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAsBxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAsC/B;;OAEG;YACW,WAAW;IA0CzB;;OAEG;IACH,OAAO,CAAC,cAAc;CAuCvB"}
@@ -1,7 +0,0 @@
1
- export { ArgParserBase, ArgParserError } from "./ArgParserBase";
2
- export { ArgParser, type McpTransportConfig, type McpSubCommandOptions } from "./ArgParser";
3
- export { zodFlagSchema, type IFlagCore, type IFlag, type ProcessedFlagCore, type ProcessedFlag, type TParsedArgsTypeFromFlagDef, type FlagsArray, type ResolveType, type ExtractFlagType, type TParsedArgs, type IHandlerContext, type MainHandler, type ISubCommand, type ArgParserInstance, } from "./types";
4
- export { generateMcpToolsFromArgParser, type IMcpToolStructure, type GenerateMcpToolsOptions, type IParseExecutionResult, } from "./mcp-integration";
5
- export { ArgParserFuzzyTester } from "./fuzzy-tester";
6
- export type { FuzzyTestOptions, TestResult, FuzzyTestReport } from "./fuzzy-tester";
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,SAAS,EACT,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,aAAa,EACb,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,iBAAiB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,6BAA6B,EAC7B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,31 +0,0 @@
1
- import type { ZodTypeAny } from "zod";
2
- import { ArgParserBase } from "./ArgParserBase";
3
- import type { ProcessedFlag, TParsedArgs } from "./";
4
- export interface IMcpToolStructure {
5
- name: string;
6
- description?: string;
7
- inputSchema: ZodTypeAny;
8
- outputSchema?: ZodTypeAny;
9
- execute: (args: any) => Promise<any>;
10
- }
11
- export interface GenerateMcpToolsOptions {
12
- outputSchemaMap?: Record<string, ZodTypeAny>;
13
- defaultOutputSchema?: ZodTypeAny;
14
- generateToolName?: (commandPath: string[], appName?: string) => string;
15
- includeSubCommands?: boolean;
16
- toolNamePrefix?: string;
17
- toolNameSuffix?: string;
18
- }
19
- interface ISpecialParseResultProps {
20
- $commandChain?: string[];
21
- $error?: {
22
- type: string;
23
- message: string;
24
- details?: any;
25
- };
26
- handlerResponse?: any;
27
- }
28
- export type IParseExecutionResult = TParsedArgs<ProcessedFlag[]> & ISpecialParseResultProps;
29
- export declare function generateMcpToolsFromArgParser(rootParser: ArgParserBase, options?: GenerateMcpToolsOptions): IMcpToolStructure[];
30
- export {};
31
- //# sourceMappingURL=mcp-integration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-integration.d.ts","sourceRoot":"","sources":["../../src/mcp-integration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,KAAK,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAA0B,aAAa,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAK7E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACtC;AAqID,MAAM,WAAW,uBAAuB;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC7C,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACvE,kBAAkB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