@alcyone-labs/arg-parser 2.14.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +20 -127
  2. package/dist/config/plugins/index.d.ts +36 -4
  3. package/dist/config/plugins/index.d.ts.map +1 -1
  4. package/dist/core/ArgParser.d.ts +124 -464
  5. package/dist/core/ArgParser.d.ts.map +1 -1
  6. package/dist/core/FlagManager.d.ts +36 -136
  7. package/dist/core/FlagManager.d.ts.map +1 -1
  8. package/dist/core/PromptManager.d.ts +42 -91
  9. package/dist/core/PromptManager.d.ts.map +1 -1
  10. package/dist/core/log-path-utils.d.ts +28 -36
  11. package/dist/core/log-path-utils.d.ts.map +1 -1
  12. package/dist/core/types.d.ts +83 -592
  13. package/dist/core/types.d.ts.map +1 -1
  14. package/dist/index.cjs +599 -9658
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +26 -15
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.min.mjs +615 -8224
  19. package/dist/index.min.mjs.map +1 -1
  20. package/dist/index.mjs +581 -8881
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/plugin/types.d.ts +121 -0
  23. package/dist/plugin/types.d.ts.map +1 -0
  24. package/dist/utils/debug-utils.d.ts +4 -26
  25. package/dist/utils/debug-utils.d.ts.map +1 -1
  26. package/package.json +12 -73
  27. package/dist/assets/.dxtignore.template +0 -37
  28. package/dist/assets/logo_1_small.jpg +0 -0
  29. package/dist/config/ConfigurationManager.d.ts +0 -82
  30. package/dist/config/ConfigurationManager.d.ts.map +0 -1
  31. package/dist/config/plugins/ConfigPlugin.d.ts +0 -60
  32. package/dist/config/plugins/ConfigPlugin.d.ts.map +0 -1
  33. package/dist/config/plugins/ConfigPluginRegistry.d.ts +0 -72
  34. package/dist/config/plugins/ConfigPluginRegistry.d.ts.map +0 -1
  35. package/dist/config/plugins/TomlConfigPlugin.d.ts +0 -30
  36. package/dist/config/plugins/TomlConfigPlugin.d.ts.map +0 -1
  37. package/dist/config/plugins/YamlConfigPlugin.d.ts +0 -29
  38. package/dist/config/plugins/YamlConfigPlugin.d.ts.map +0 -1
  39. package/dist/core/ArgParserBase.d.ts +0 -319
  40. package/dist/core/ArgParserBase.d.ts.map +0 -1
  41. package/dist/core/dxt-path-resolver.d.ts +0 -100
  42. package/dist/core/dxt-path-resolver.d.ts.map +0 -1
  43. package/dist/dxt/DxtGenerator-testUtils.d.ts +0 -22
  44. package/dist/dxt/DxtGenerator-testUtils.d.ts.map +0 -1
  45. package/dist/dxt/DxtGenerator.d.ts +0 -120
  46. package/dist/dxt/DxtGenerator.d.ts.map +0 -1
  47. package/dist/mcp/ArgParserMcp.d.ts +0 -21
  48. package/dist/mcp/ArgParserMcp.d.ts.map +0 -1
  49. package/dist/mcp/mcp-integration.d.ts +0 -86
  50. package/dist/mcp/mcp-integration.d.ts.map +0 -1
  51. package/dist/mcp/mcp-lifecycle.d.ts +0 -163
  52. package/dist/mcp/mcp-lifecycle.d.ts.map +0 -1
  53. package/dist/mcp/mcp-notifications.d.ts +0 -132
  54. package/dist/mcp/mcp-notifications.d.ts.map +0 -1
  55. package/dist/mcp/mcp-prompts.d.ts +0 -132
  56. package/dist/mcp/mcp-prompts.d.ts.map +0 -1
  57. package/dist/mcp/mcp-protocol-versions.d.ts +0 -150
  58. package/dist/mcp/mcp-protocol-versions.d.ts.map +0 -1
  59. package/dist/mcp/mcp-resources.d.ts +0 -133
  60. package/dist/mcp/mcp-resources.d.ts.map +0 -1
  61. package/dist/mcp/mcp-utils.d.ts +0 -20
  62. package/dist/mcp/mcp-utils.d.ts.map +0 -1
  63. package/dist/mcp/zod-compatibility.d.ts +0 -74
  64. package/dist/mcp/zod-compatibility.d.ts.map +0 -1
  65. package/dist/testing/fuzzy-test-cli.d.ts +0 -5
  66. package/dist/testing/fuzzy-test-cli.d.ts.map +0 -1
  67. package/dist/testing/fuzzy-tester.d.ts +0 -101
  68. package/dist/testing/fuzzy-tester.d.ts.map +0 -1
  69. package/dist/tui/index.d.ts +0 -281
  70. package/dist/tui/types.d.ts +0 -60
  71. package/dist/tui/types.d.ts.map +0 -1
  72. package/dist/tui.cjs +0 -1060
  73. package/dist/tui.cjs.map +0 -1
  74. package/dist/tui.mjs +0 -967
  75. package/dist/tui.mjs.map +0 -1
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Plugin system for ArgParser
3
+ *
4
+ * This module provides the foundation for extending ArgParser functionality
5
+ * through a plugin architecture. Plugins can add new methods, modify behavior,
6
+ * or integrate with external systems like MCP, DXT, or TUI.
7
+ */
8
+ type ArgParserBase<_T = any> = any;
9
+ /**
10
+ * Plugin interface for extending ArgParser functionality
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const myPlugin = (options: MyOptions): IArgParserPlugin => ({
15
+ * name: 'my-plugin',
16
+ * version: '1.0.0',
17
+ * install(parser) {
18
+ * // Extend parser with custom functionality
19
+ * (parser as any).myMethod = () => {
20
+ * // Implementation
21
+ * };
22
+ * }
23
+ * });
24
+ *
25
+ * const parser = new ArgParser({...})
26
+ * .use(myPlugin({...}));
27
+ * ```
28
+ */
29
+ export interface IArgParserPlugin {
30
+ /** Unique plugin identifier (should be reverse-DNS style, e.g., 'com.alcyone.mcp') */
31
+ readonly name: string;
32
+ /** Plugin version (semver) */
33
+ readonly version?: string;
34
+ /**
35
+ * Install the plugin into an ArgParser instance
36
+ * @param parser - The ArgParser instance to extend
37
+ * @returns The modified parser or void
38
+ */
39
+ install<T>(parser: ArgParserBase<T>): ArgParserBase<T> | void;
40
+ /**
41
+ * Optional cleanup when parser is destroyed
42
+ */
43
+ destroy?(): void;
44
+ }
45
+ /**
46
+ * Plugin metadata for introspection and dependency management
47
+ */
48
+ export interface IPluginMetadata {
49
+ name: string;
50
+ version: string;
51
+ description?: string;
52
+ author?: string;
53
+ dependencies?: string[];
54
+ peerDependencies?: string[];
55
+ }
56
+ /**
57
+ * Plugin registry for managing installed plugins
58
+ *
59
+ * This class tracks which plugins are installed on a parser instance
60
+ * and provides methods for introspection.
61
+ */
62
+ export declare class PluginRegistry {
63
+ private plugins;
64
+ private metadata;
65
+ /**
66
+ * Register a plugin in the registry
67
+ */
68
+ register(plugin: IArgParserPlugin, metadata?: IPluginMetadata): void;
69
+ /**
70
+ * Get a registered plugin by name
71
+ */
72
+ get(name: string): IArgParserPlugin | undefined;
73
+ /**
74
+ * Check if a plugin is registered
75
+ */
76
+ has(name: string): boolean;
77
+ /**
78
+ * List all registered plugin names
79
+ */
80
+ list(): string[];
81
+ /**
82
+ * Get metadata for a plugin
83
+ */
84
+ getMetadata(name: string): IPluginMetadata | undefined;
85
+ /**
86
+ * Unregister a plugin
87
+ */
88
+ unregister(name: string): boolean;
89
+ /**
90
+ * Clear all registered plugins
91
+ */
92
+ clear(): void;
93
+ }
94
+ /**
95
+ * Global plugin registry for system-wide plugin management
96
+ */
97
+ export declare const globalPluginRegistry: PluginRegistry;
98
+ /**
99
+ * Decorator for plugin methods that should be exposed on the parser
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * class MyPlugin implements IArgParserPlugin {
104
+ * name = 'my-plugin';
105
+ *
106
+ @expose()
107
+ * myMethod(parser: ArgParserBase, ...args: any[]) {
108
+ * // Implementation
109
+ * }
110
+ * }
111
+ * ```
112
+ */
113
+ export declare function expose(_target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
114
+ /**
115
+ * Utility type for extracting plugin methods
116
+ */
117
+ export type PluginMethods<T> = T extends IArgParserPlugin ? {
118
+ [K in keyof T as T[K] extends Function ? K : never]: T[K];
119
+ } : never;
120
+ export {};
121
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,KAAK,aAAa,CAAC,EAAE,GAAG,GAAG,IAAI,GAAG,CAAC;AAEnC;;;;;;;;;;;;;;;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GAcG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,sBAKvF;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,gBAAgB,GACrD;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAC7D,KAAK,CAAC"}
@@ -1,34 +1,12 @@
1
1
  /**
2
- * Debug logger that only outputs when DEBUG environment variable is set
2
+ * Debug utilities for ArgParser
3
+ */
4
+ /**
5
+ * Debug logger that only logs when DEBUG environment variable is set
3
6
  */
4
7
  export declare const debug: {
5
- /**
6
- * Log a debug message to stderr (only when DEBUG=true)
7
- */
8
8
  log: (...args: any[]) => void;
9
- /**
10
- * Log an error debug message to stderr (only when DEBUG=true)
11
- */
12
9
  error: (...args: any[]) => void;
13
- /**
14
- * Log a warning debug message to stderr (only when DEBUG=true)
15
- */
16
10
  warn: (...args: any[]) => void;
17
- /**
18
- * Log an info debug message to stderr (only when DEBUG=true)
19
- */
20
- info: (...args: any[]) => void;
21
- /**
22
- * Log a debug message with a custom prefix (only when DEBUG=true)
23
- */
24
- prefixed: (prefix: string, ...args: any[]) => void;
25
- /**
26
- * Check if debug mode is currently enabled
27
- */
28
- readonly enabled: boolean;
29
11
  };
30
- /**
31
- * Default export for convenience
32
- */
33
- export default debug;
34
12
  //# sourceMappingURL=debug-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug-utils.d.ts","sourceRoot":"","sources":["../../src/utils/debug-utils.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,eAAO,MAAM,KAAK;IAChB;;OAEG;mBACY,GAAG,EAAE,KAAG,IAAI;IAO3B;;OAEG;qBACc,GAAG,EAAE,KAAG,IAAI;IAO7B;;OAEG;oBACa,GAAG,EAAE,KAAG,IAAI;IAO5B;;OAEG;oBACa,GAAG,EAAE,KAAG,IAAI;IAO5B;;OAEG;uBACgB,MAAM,WAAW,GAAG,EAAE,KAAG,IAAI;IAOhD;;OAEG;sBACY,OAAO;CAGvB,CAAC;AAEF;;GAEG;AACH,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"debug-utils.d.ts","sourceRoot":"","sources":["../../src/utils/debug-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,KAAK;mBACD,GAAG,EAAE;qBAMH,GAAG,EAAE;oBAMN,GAAG,EAAE;CAKtB,CAAC"}
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "@alcyone-labs/arg-parser",
3
- "version": "2.14.2",
4
- "description": "A robust, type-safe CLI builder with out-of-the-box support for creating MCPs and bundling Claude Desktop's DXT packages",
3
+ "version": "3.0.0",
4
+ "description": "A robust, type-safe CLI argument parser with plugin support",
5
5
  "keywords": [
6
6
  "Arg Parser",
7
7
  "CLI",
8
8
  "CLI Commands",
9
- "DXT",
10
- "LLM Tool Calls",
11
- "MCP",
9
+ "Plugin System",
12
10
  "Sub-commands"
13
11
  ],
14
12
  "license": "MIT",
@@ -31,13 +29,8 @@
31
29
  "dist/index.min.mjs.map",
32
30
  "dist/index.mjs",
33
31
  "dist/index.mjs.map",
34
- "dist/tui.cjs",
35
- "dist/tui.cjs.map",
36
- "dist/tui.mjs",
37
- "dist/tui.mjs.map",
38
32
  "dist/**/*.d.ts",
39
- "dist/**/*.d.ts.map",
40
- "dist/assets/**/*"
33
+ "dist/**/*.d.ts.map"
41
34
  ],
42
35
  "type": "module",
43
36
  "main": "dist/index.cjs",
@@ -49,98 +42,44 @@
49
42
  "import": "./dist/index.mjs",
50
43
  "require": "./dist/index.cjs"
51
44
  },
52
- "./tui": {
53
- "types": "./dist/tui/index.d.ts",
54
- "import": "./dist/tui.mjs",
55
- "require": "./dist/tui.cjs"
56
- },
57
45
  "./package.json": "./package.json"
58
46
  },
59
47
  "dependencies": {
60
48
  "@alcyone-labs/simple-chalk": "^1.0.2",
61
- "@alcyone-labs/simple-mcp-logger": "^1.2.1",
62
49
  "@clack/prompts": "^1.0.0",
63
- "@modelcontextprotocol/sdk": "^1.25.3",
64
- "get-tsconfig": "^4.13.1",
65
50
  "magic-regexp": "^0.10.0",
66
- "solid-js": "^1.9.11",
67
51
  "zod": "^4.3.6"
68
52
  },
69
53
  "devDependencies": {
70
- "@types/adm-zip": "^0.5.7",
71
- "@types/express": "^5.0.6",
72
- "@types/js-yaml": "^4.0.9",
73
54
  "@types/node": "^25.2.0",
74
55
  "cross-env": "^10.1.0",
75
- "madge": "^8.0.0",
76
56
  "oxfmt": "^0.28.0",
77
57
  "oxlint": "^1.43.0",
78
- "ts-node": "^10.9.2",
79
58
  "tsx": "^4.21.0",
80
59
  "typescript": "^5.9.3",
81
60
  "vite": "npm:rolldown-vite@^7.3.1",
82
- "vite-plugin-solid": "2.11.6",
83
61
  "vite-tsconfig-paths": "^6.0.5",
84
62
  "vitest": "^4.0.18"
85
63
  },
86
- "peerDependencies": {
87
- "@opentui/core": ">=0.1.67",
88
- "@opentui/solid": ">=0.1.67"
89
- },
90
- "optionalDependencies": {
91
- "dotenv": "^17.2.3",
92
- "express": "^5.2.1",
93
- "js-yaml": "^4.1.1",
94
- "smol-toml": "^1.6.0",
95
- "tsdown": "^0.20.1"
96
- },
97
64
  "engines": {
98
65
  "node": ">=18.0.0"
99
66
  },
100
67
  "scripts": {
101
- "clean": "rm -rf dist dist-examples",
68
+ "clean": "rm -rf dist",
102
69
  "build:types": "tsc --project tsconfig.json --emitDeclarationOnly",
103
- "build:types:tui": "tsc --project tsconfig.tui-types.json",
104
- "build:cjs": "cross-env VITE_BUILD_FORMAT=cjs vite build",
105
- "build:esm": "cross-env VITE_BUILD_FORMAT=es VITE_MINIFY_BUILD=false vite build",
106
- "build:min": "cross-env VITE_BUILD_FORMAT=es VITE_MINIFY_BUILD=true vite build",
107
- "build:tui:cjs": "cross-env VITE_BUILD_FORMAT=cjs VITE_BUILD_ENTRY=tui vite build",
108
- "build:tui:esm": "cross-env VITE_BUILD_FORMAT=es VITE_BUILD_ENTRY=tui vite build",
109
- "build": "pnpm clean && pnpm run build:types && pnpm run build:cjs && pnpm run build:esm && pnpm run build:min && pnpm run build:tui:cjs && pnpm run build:tui:esm && pnpm run build:assets",
110
- "build:assets": "mkdir -p dist/assets dist/tui && cp docs/MCP/icons/logo_1_small.jpg dist/assets/ && cp .dxtignore.template dist/assets/ && cp src/tui/index.d.ts dist/tui/index.d.ts",
70
+ "build:cjs": "cross-env VITE_BUILD_FORMAT=cjs vite build --config vite.config.build.ts",
71
+ "build:esm": "cross-env VITE_BUILD_FORMAT=es VITE_MINIFY_BUILD=false vite build --config vite.config.build.ts",
72
+ "build:min": "cross-env VITE_BUILD_FORMAT=es VITE_MINIFY_BUILD=true vite build --config vite.config.build.ts",
73
+ "build": "pnpm clean && pnpm run build:types && pnpm run build:cjs && pnpm run build:esm && pnpm run build:min",
111
74
  "build:watch": "tsc --watch",
112
- "bump": "tsx scripts/bump-version.ts",
113
- "build:examples": "tsc --project tsconfig.examples.json",
114
- "test": "vitest run --exclude=\"**/integration/**\"",
115
- "test:all": "vitest run",
116
- "test:integration": "cross-env VITEST_INCLUDE_INTEGRATION=1 vitest run --testTimeout=30000 --fileParallelism=false tests/mcp/integration/",
75
+ "test": "vitest run",
117
76
  "test:watch": "vitest",
77
+ "test:coverage": "vitest run --coverage",
118
78
  "test:ui": "vitest --ui",
119
- "test:mcp": "bun tests/mcp/integration/run-integration-tests.ts",
120
- "test:mcp:verbose": "bun tests/mcp/integration/run-integration-tests.ts --verbose",
121
- "test:mcp:e2e": "bun tests/mcp/integration/run-integration-tests.ts --suite end-to-end",
122
- "test:mcp:protocol": "bun tests/mcp/integration/run-integration-tests.ts --suite protocol-compliance",
123
- "test:mcp:performance": "bun tests/mcp/integration/run-integration-tests.ts --suite performance",
124
- "test:mcp:canny": "bun tests/mcp/integration/run-integration-tests.ts --suite canny-cli",
125
- "test:mcp:compliance": "vitest run tests/mcp/compliance/",
126
- "test:mcp:dxt": "vitest run tests/mcp/compliance/dxt-compliance.test.ts",
127
79
  "format": "oxfmt .",
128
80
  "format:check": "oxfmt --check .",
129
81
  "lint": "oxlint .",
130
82
  "lint:fix": "oxlint --fix .",
131
- "check:cir-dep": "madge ./ -c --ts-config tsconfig.dev.json",
132
- "check:types": "tsc --project ./tsconfig.dev.json --noEmit",
133
- "build:checks": "pnpm check:cir-dep && pnpm check:types",
134
- "test:built": "node test-built-library.mjs",
135
- "test:post-publish": "node scripts/post-publish-validation.mjs",
136
- "test:post-publish:mcp": "node scripts/post-publish-mcp-validation.mjs",
137
- "test:post-publish:all": "pnpm test:post-publish && pnpm test:post-publish:mcp",
138
- "validate:v2": "node scripts/validate-v2.mjs",
139
- "dxt:validate": "npx @anthropic-ai/dxt validate",
140
- "dxt:info": "npx @anthropic-ai/dxt info",
141
- "dxt:sign": "npx @anthropic-ai/dxt sign --self-signed",
142
- "dxt:pack": "npx @anthropic-ai/dxt pack",
143
- "dxt:unpack": "npx @anthropic-ai/dxt unpack",
144
- "dxt:verify": "npx @anthropic-ai/dxt verify"
83
+ "check:types": "tsc --project ./tsconfig.json --noEmit"
145
84
  }
146
85
  }
@@ -1,37 +0,0 @@
1
- # DXT ignore file template
2
- # Generated by @alcyone-labs/arg-parser
3
-
4
- # Development files
5
- .git/
6
- .gitignore
7
- .env
8
- .env.*
9
-
10
- # OS files
11
- .DS_Store
12
- Thumbs.db
13
-
14
- # IDE files
15
- .vscode/
16
- .idea/
17
- *.swp
18
- *.swo
19
-
20
- # Test files
21
- test/
22
- tests/
23
- *.test.js
24
- *.test.ts
25
- *.spec.js
26
- *.spec.ts
27
-
28
- # Build artifacts and logs
29
- *.log
30
- *.tmp
31
- temp-dxt-build/
32
-
33
- # TSDown config files (not needed in final package)
34
- .dxtignore.template
35
-
36
- # Source files (replaced by bundled output)
37
- # Note: The original entry point will be replaced by the bundled version
Binary file
@@ -1,82 +0,0 @@
1
- import type { ProcessedFlag, TParsedArgs } from "../core/types";
2
- /**
3
- * ConfigurationManager handles environment file operations, format conversion,
4
- * and configuration merging for ArgParser instances.
5
- */
6
- export declare class ConfigurationManager {
7
- private argParserInstance;
8
- constructor(argParserInstance: any);
9
- /**
10
- * Generates a default environment file name based on app configuration
11
- */
12
- generateDefaultEnvFileName(): string;
13
- /**
14
- * Handles the --s-save-to-env system flag at the final parser level
15
- */
16
- handleSaveToEnvFlag(processArgs: string[], parserChain: any[]): boolean;
17
- /**
18
- * Saves current configuration to an environment file
19
- */
20
- saveToEnvFile(filePath: string, _processArgs: string[], parserChain: any[]): void;
21
- /**
22
- * Loads configuration from an environment file
23
- */
24
- loadEnvFile(filePath: string, parserChain: any[]): Record<string, any>;
25
- /**
26
- * Parses environment file content
27
- */
28
- parseEnvFile(content: string): Record<string, any>;
29
- /**
30
- * Parses YAML file content (legacy method - now uses plugin system)
31
- */
32
- parseYamlFile(content: string): Record<string, any>;
33
- /**
34
- * Discovers .env files in a specified directory
35
- * Searches in priority order: .env.local, .env.dev/.env.test, .env
36
- *
37
- * @param searchDir - The directory to search for .env files
38
- * @returns Path to found .env file, or null if none is found
39
- */
40
- discoverEnvFile(searchDir: string): string | null;
41
- /**
42
- * Parses JSON file content
43
- */
44
- parseJsonFile(content: string): Record<string, any>;
45
- /**
46
- * Parses TOML file content (legacy method - now uses plugin system)
47
- */
48
- parseTomlFile(content: string): Record<string, any>;
49
- /**
50
- * Converts raw configuration to flag values with proper type conversion
51
- */
52
- convertConfigToFlagValues(rawConfig: Record<string, any>, parserChain: any[]): Record<string, any>;
53
- /**
54
- * Converts a value to the appropriate flag type
55
- */
56
- convertValueToFlagType(value: any, flag: ProcessedFlag): any;
57
- /**
58
- * Merges environment configuration with command line arguments
59
- */
60
- mergeEnvConfigWithArgs(envConfig: Record<string, any>, processArgs: string[], parserChain?: any[]): string[];
61
- /**
62
- * Generates environment file format
63
- */
64
- generateEnvFormat(flags: ProcessedFlag[], parsedArgs: TParsedArgs<any>): string;
65
- /**
66
- * Generates YAML file format (legacy method - now uses plugin system)
67
- */
68
- generateYamlFormat(flags: ProcessedFlag[], parsedArgs: TParsedArgs<any>): string;
69
- /**
70
- * Generates JSON file format
71
- */
72
- generateJsonFormat(flags: ProcessedFlag[], parsedArgs: TParsedArgs<any>): string;
73
- /**
74
- * Generates TOML file format (legacy method - now uses plugin system)
75
- */
76
- generateTomlFormat(flags: ProcessedFlag[], parsedArgs: TParsedArgs<any>): string;
77
- /**
78
- * Gets a string representation of a flag type
79
- */
80
- private getTypeString;
81
- }
82
- //# sourceMappingURL=ConfigurationManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConfigurationManager.d.ts","sourceRoot":"","sources":["../../src/config/ConfigurationManager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGhE;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,iBAAiB,CAAM;gBAEnB,iBAAiB,EAAE,GAAG;IAOlC;;OAEG;IACI,0BAA0B,IAAI,MAAM;IAqB3C;;OAEG;IACI,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,OAAO;IAyB9E;;OAEG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,IAAI;IAmExF;;OAEG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IA+C7E;;OAEG;IACI,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IA4BzD;;OAEG;IACI,aAAa,CAAC,OAAO,EAA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,60 +0,0 @@
1
- /**
2
- * Plugin interface for configuration file format support
3
- */
4
- export interface IConfigPlugin {
5
- /**
6
- * File extensions this plugin supports (e.g., ['.toml', '.tml'])
7
- */
8
- readonly supportedExtensions: string[];
9
- /**
10
- * Plugin name for identification
11
- */
12
- readonly name: string;
13
- /**
14
- * Parse configuration file content
15
- * @param content File content as string
16
- * @returns Parsed configuration object
17
- */
18
- parse(content: string): Record<string, any>;
19
- /**
20
- * Generate configuration file content
21
- * @param config Configuration object
22
- * @param flags Flag definitions for metadata
23
- * @param parsedArgs Parsed arguments for values
24
- * @returns Generated file content
25
- */
26
- generate(config: Record<string, any>, flags: any[], parsedArgs: any): string;
27
- }
28
- /**
29
- * Base class for configuration plugins
30
- */
31
- export declare abstract class ConfigPlugin implements IConfigPlugin {
32
- abstract readonly supportedExtensions: string[];
33
- abstract readonly name: string;
34
- abstract parse(content: string): Record<string, any>;
35
- abstract generate(config: Record<string, any>, flags: any[], parsedArgs: any): string;
36
- /**
37
- * Check if this plugin supports a given file extension
38
- */
39
- supportsExtension(extension: string): boolean;
40
- }
41
- /**
42
- * Built-in JSON configuration plugin (no external dependencies)
43
- */
44
- export declare class JsonConfigPlugin extends ConfigPlugin {
45
- readonly supportedExtensions: string[];
46
- readonly name = "json";
47
- parse(content: string): Record<string, any>;
48
- generate(_config: Record<string, any>, flags: any[], parsedArgs: any): string;
49
- }
50
- /**
51
- * Built-in ENV configuration plugin (no external dependencies)
52
- */
53
- export declare class EnvConfigPlugin extends ConfigPlugin {
54
- readonly supportedExtensions: string[];
55
- readonly name = "env";
56
- parse(content: string): Record<string, any>;
57
- generate(_config: Record<string, any>, flags: any[], parsedArgs: any): string;
58
- private getTypeString;
59
- }
60
- //# sourceMappingURL=ConfigPlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConfigPlugin.d.ts","sourceRoot":"","sources":["../../../src/config/plugins/ConfigPlugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,a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SAAQ,YAAY;IAC/C,QAAQ,CAAC,mBAAmB,WAAY;IACxC,QAAQ,CAAC,IAAI,SAAS;IAEtB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IA4B3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,GAAG,MAAM;IAmC7E,OAAO,CAAC,aAAa;CAMtB"}
@@ -1,72 +0,0 @@
1
- import type { IConfigPlugin } from "./ConfigPlugin";
2
- /**
3
- * Registry for configuration plugins
4
- * Manages available config format plugins and provides plugin lookup
5
- */
6
- export declare class ConfigPluginRegistry {
7
- private plugins;
8
- private extensionMap;
9
- constructor();
10
- /**
11
- * Register a configuration plugin
12
- */
13
- registerPlugin(plugin: IConfigPlugin): void;
14
- /**
15
- * Get plugin by name
16
- */
17
- getPlugin(name: string): IConfigPlugin | undefined;
18
- /**
19
- * Get plugin by file extension
20
- */
21
- getPluginByExtension(extension: string): IConfigPlugin | undefined;
22
- /**
23
- * Check if a file extension is supported
24
- */
25
- isExtensionSupported(extension: string): boolean;
26
- /**
27
- * Get all registered plugin names
28
- */
29
- getRegisteredPlugins(): string[];
30
- /**
31
- * Get all supported extensions
32
- */
33
- getSupportedExtensions(): string[];
34
- /**
35
- * Unregister a plugin
36
- */
37
- unregisterPlugin(name: string): boolean;
38
- /**
39
- * Clear all plugins (useful for testing)
40
- */
41
- clear(): void;
42
- /**
43
- * Auto-register optional plugins if their dependencies are available
44
- * This method attempts to load TOML and YAML plugins without throwing errors
45
- */
46
- autoRegisterOptionalPlugins(): void;
47
- /**
48
- * Async version of auto-register optional plugins with ESM support
49
- * This method attempts to load TOML and YAML plugins without throwing errors
50
- */
51
- autoRegisterOptionalPluginsAsync(): Promise<void>;
52
- }
53
- /**
54
- * Global plugin registry instance
55
- * This can be used throughout the application
56
- */
57
- export declare const globalConfigPluginRegistry: ConfigPluginRegistry;
58
- /**
59
- * Convenience function to register optional plugins
60
- * Call this once at application startup if you want TOML/YAML support
61
- */
62
- export declare function enableOptionalConfigPlugins(): void;
63
- /**
64
- * Async convenience function to register optional plugins with ESM support
65
- * Call this once at application startup if you want TOML/YAML support in ESM environments
66
- */
67
- export declare function enableOptionalConfigPluginsAsync(): Promise<void>;
68
- /**
69
- * Convenience function to register only specific plugins
70
- */
71
- export declare function enableConfigPlugins(pluginNames: string[]): void;
72
- //# sourceMappingURL=ConfigPluginRegistry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConfigPluginRegistry.d.ts","sourceRoot":"","sources":["../../../src/config/plugins/ConfigPluginRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,OAAO,CAAyC;IACxD,OAAO,CAAC,YAAY,CAAyC;;IAQ7D;;OAEG;IACI,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IASlD;;OAEG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAIzD;;OAEG;IACI,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAIzE;;OAEG;IACI,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIvD;;OAEG;IACI,oBAAoB,IAAI,MAAM,EAAE;IAIvC;;OAEG;IACI,sBAAsB,IAAI,MAAM,EAAE;IAIzC;;OAEG;IACI,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAiB9C;;OAEG;IACI,KAAK,IAAI,IAAI;IAKpB;;;OAGG;IACI,2BAA2B,IAAI,IAAI;IAwB1C;;;OAGG;IACU,gCAAgC,IAAI,OAAO,CAAC,IAAI,CAAC;CAuB/D;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,sBAA6B,CAAC;AAErE;;;GAGG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAElD;AAED;;;GAGG;AACH,wBAAsB,gCAAgC,IAAI,OAAO,CAAC,IAAI,CAAC,CAEtE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAmC/D"}
@@ -1,30 +0,0 @@
1
- import { ConfigPlugin } from "./ConfigPlugin";
2
- /**
3
- * TOML configuration plugin (requires smol-toml dependency)
4
- * This plugin is optional and only loaded when TOML support is needed
5
- */
6
- export declare class TomlConfigPlugin extends ConfigPlugin {
7
- readonly supportedExtensions: string[];
8
- readonly name = "toml";
9
- private tomlModule;
10
- constructor(tomlModule?: any);
11
- private loadTomlModule;
12
- parse(content: string): Record<string, any>;
13
- generate(_config: Record<string, any>, flags: any[], parsedArgs: any): string;
14
- /**
15
- * Simple TOML parsing fallback for basic key-value pairs
16
- */
17
- private parseTomlSimple;
18
- private getTypeString;
19
- }
20
- /**
21
- * Factory function to create TOML plugin safely
22
- * Returns null if TOML dependency is not available
23
- */
24
- export declare function createTomlPlugin(): TomlConfigPlugin | null;
25
- /**
26
- * Async factory function to create TOML plugin with ESM support
27
- * Returns null if TOML dependency is not available
28
- */
29
- export declare function createTomlPluginAsync(): Promise<TomlConfigPlugin | null>;
30
- //# sourceMappingURL=TomlConfigPlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TomlConfigPlugin.d.ts","sourceRoot":"","sources":["../../../src/config/plugins/TomlConfigPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,QAAQ,CAAC,mBAAmB,WAAqB;IACjD,QAAQ,CAAC,IAAI,UAAU;IAEvB,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,CAAC,EAAE,GAAG;IAS5B,OAAO,CAAC,cAAc;IAiBtB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAmB3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,GAAG,MAAM;IAqD7E;;OAEG;IACH,OAAO,CAAC,eAAe;IA4BvB,OAAO,CAAC,aAAa;CAMtB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,gBAAgB,GAAG,IAAI,CAU1D;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAsB9E"}
@@ -1,29 +0,0 @@
1
- import { ConfigPlugin } from "./ConfigPlugin";
2
- /**
3
- * YAML configuration plugin (requires js-yaml dependency)
4
- * This plugin is optional and only loaded when YAML support is needed
5
- */
6
- export declare class YamlConfigPlugin extends ConfigPlugin {
7
- readonly supportedExtensions: string[];
8
- readonly name = "yaml";
9
- private yamlModule;
10
- constructor(yamlModule?: any);
11
- private loadYamlModule;
12
- parse(content: string): Record<string, any>;
13
- generate(_config: Record<string, any>, flags: any[], parsedArgs: any): string;
14
- /**
15
- * Simple YAML parsing fallback for basic key-value pairs
16
- */
17
- private parseYamlSimple;
18
- }
19
- /**
20
- * Factory function to create YAML plugin safely
21
- * Returns null if YAML dependency is not available
22
- */
23
- export declare function createYamlPlugin(): YamlConfigPlugin | null;
24
- /**
25
- * Async factory function to create YAML plugin with ESM support
26
- * Returns null if YAML dependency is not available
27
- */
28
- export declare function createYamlPluginAsync(): Promise<YamlConfigPlugin | null>;
29
- //# sourceMappingURL=YamlConfigPlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"YamlConfigPlugin.d.ts","sourceRoot":"","sources":["../../../src/config/plugins/YamlConfigPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,QAAQ,CAAC,mBAAmB,WAAqB;IACjD,QAAQ,CAAC,IAAI,UAAU;IAEvB,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,CAAC,EAAE,GAAG;IAS5B,OAAO,CAAC,cAAc;IAetB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAmB3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,GAAG,MAAM;IA4C7E;;OAEG;IACH,OAAO,CAAC,eAAe;CA2BxB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,gBAAgB,GAAG,IAAI,CAU1D;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAsB9E"}