@alcyone-labs/arg-parser 2.14.1 → 3.0.0-beta.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.
Files changed (75) hide show
  1. package/README.md +22 -129
  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 +29 -37
  11. package/dist/core/log-path-utils.d.ts.map +1 -1
  12. package/dist/core/types.d.ts +89 -604
  13. package/dist/core/types.d.ts.map +1 -1
  14. package/dist/index.cjs +599 -9697
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +29 -18
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.min.mjs +612 -8263
  19. package/dist/index.min.mjs.map +1 -1
  20. package/dist/index.mjs +581 -8920
  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 +13 -74
  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
package/README.md CHANGED
@@ -1,153 +1,46 @@
1
- # ArgParser - Type-Safe Command Line Argument Parser
1
+ # @alcyone-labs/arg-parser v3.0.0
2
2
 
3
- A modern, type-safe command line argument parser with built-in MCP (Model Context Protocol) integration, real-time MCP Resources, and automatic Claude Desktop Extension (DXT) generation.
4
-
5
- ## Table of Contents
6
-
7
- - [Features Overview](#features-overview)
8
- - [Installation](#installation)
9
- - [Quick Start: The Unified `addTool` API](#quick-start-the-unified-addtool-api)
10
- - [Documentation](#documentation)
11
- - [How to Run It](#how-to-run-it)
12
- - [OpenTUI: Reactive Rich Terminal Interfaces](#opentui-reactive-rich-terminal-interfaces)
13
- - [System Flags & Configuration](#system-flags--configuration)
14
- - [Links](#links)
15
-
16
- ## Features Overview
17
-
18
- - **Unified Tool Architecture**: Define tools once with `addTool()` and they automatically function as both CLI subcommands and MCP tools.
19
- - **Type-safe flag definitions** with full TypeScript support and autocompletion.
20
- - **Automatic MCP Integration**: Transform any CLI into a compliant MCP server with a single command (`--s-mcp-serve`).
21
- - **MCP Resources with Real-Time Feeds** ⭐: Create subscription-based data feeds with URI templates for live notifications to AI assistants.
22
- - **Console Safe**: `console.log` and other methods are automatically handled in MCP mode to prevent protocol contamination.
23
- - **DXT Package Generation**: Generate complete, ready-to-install Claude Desktop Extension (`.dxt`) packages.
24
- - **Hierarchical Sub-commands**: Create complex, nested sub-command structures with flag inheritance.
25
- - **Configuration Management**: Easily load (`--s-with-env`) and save (`--s-save-to-env`) configurations.
26
- - **OpenTUI Framework** ⭐: A reactive TUI engine built on SolidJS with mouse support and themes.
3
+ A robust, type-safe CLI argument parser with plugin support.
27
4
 
28
5
  ## Installation
29
6
 
30
7
  ```bash
31
- # Using PNPM (recommended)
32
- pnpm add @alcyone-labs/arg-parser
8
+ npm install @alcyone-labs/arg-parser
33
9
  ```
34
10
 
35
- ## Quick Start: The Unified `addTool` API
36
-
37
- The modern way to build with ArgParser is using the `.addTool()` method.
11
+ ## Quick Start
38
12
 
39
13
  ```typescript
40
- import { z } from "zod";
41
- import { ArgParser } from "@alcyone-labs/arg-parser";
14
+ import { ArgParser } from '@alcyone-labs/arg-parser';
42
15
 
43
- const cli = ArgParser.withMcp({
44
- appName: "My Awesome CLI",
45
- appCommandName: "mycli",
46
- description: "A tool that works in both CLI and MCP mode",
47
- mcp: {
48
- serverInfo: { name: "my-awesome-mcp-server", version: "1.0.0" },
49
- },
50
- }).addTool({
51
- name: "greet",
52
- description: "A tool to greet someone",
53
- flags: [{ name: "name", type: "string", mandatory: true, options: ["--name"] }],
16
+ const parser = new ArgParser({
17
+ appName: 'my-cli',
54
18
  handler: async (ctx) => {
55
- console.log(`Hey ${ctx.args.name}!`);
56
- return { success: true, greeting: `Hey ${ctx.args.name}!` };
57
- },
19
+ console.log('Hello', ctx.args.name);
20
+ }
58
21
  });
59
22
 
60
- await cli.parse();
61
- ```
62
-
63
- ## Documentation
64
-
65
- For detailed information, please refer to the following guides:
66
-
67
- - 📖 **[Core Concepts](./docs/CORE_CONCEPTS.md)**: Flag definitions, type handling, validation, and positional arguments.
68
- - 🤖 **[MCP & Claude Desktop Integration](./docs/MCP.md)**: Full guide on MCP servers, DXT bundling, and Claude integration.
69
- - 🖥️ **[OpenTUI Reference](./docs/TUI.md)**: Building rich terminal interfaces with SolidJS.
70
- - 📂 **[Working Directory Management](./docs/WORKING_DIRECTORY.md)**: Handling PWD and monorepos.
71
- - 🚀 **[Migration Guide (v1 to v2)](./docs/MIGRATION_V2.md)**: Moving to the unified `addTool` API.
72
-
73
- ## How to Run It
74
-
75
- ```bash
76
- # 1. As a standard CLI subcommand
77
- mycli greet --name Jane
78
-
79
- # 2. As an MCP server
80
- mycli --s-mcp-serve
81
-
82
- # 3. Generate a DXT package
83
- mycli --s-build-dxt ./my-dxt-package
23
+ await parser.parse();
84
24
  ```
85
25
 
86
- ## OpenTUI: Reactive Rich Terminal Interfaces
87
-
88
- ArgParser includes **OpenTUI v2**, a reactive TUI framework built on SolidJS.
89
-
90
- > 📖 **Full Documentation**: [docs/TUI.md](./docs/TUI.md) | [Component Reference](./docs/TUI_COMPONENTS.md)
26
+ ## Plugin System
91
27
 
92
- ### Runtime Requirements
93
-
94
- > ⚠️ **Important**: OpenTUI requires **Bun** to run, not Node.js.
95
-
96
- When building TUI applications with OpenTUI, ensure your project uses Bun:
97
-
98
- ```bash
99
- # Install dependencies with Bun
100
- bun install
101
-
102
- # Run your TUI application with Bun
103
- bun run src/index.ts
104
- ```
105
-
106
- Node.js does not support OpenTUI's terminal rendering capabilities. Most CI environments and remote containers use Node.js by default - configure them to use Bun instead.
107
-
108
- ### Quick TUI Example
28
+ ArgParser v3.0.0 introduces a plugin architecture. Install plugins to add functionality:
109
29
 
110
30
  ```typescript
111
- import { createTuiApp } from "@alcyone-labs/arg-parser/tui";
112
- import { TuiProvider } from "@alcyone-labs/arg-parser/tui";
31
+ import { ArgParser } from '@alcyone-labs/arg-parser';
32
+ import { mcpPlugin } from '@alcyone-labs/arg-parser-mcp';
113
33
 
114
- function App() {
115
- return (
116
- <box border padding={2}>
117
- <text>Hello from OpenTUI!</text>
118
- </box>
119
- );
120
- }
121
-
122
- createTuiApp(() => (
123
- <TuiProvider theme="dark">
124
- <App />
125
- </TuiProvider>
126
- ));
34
+ const parser = new ArgParser({...})
35
+ .use(mcpPlugin({ serverInfo: { name: 'my-server', version: '1.0.0' } }));
127
36
  ```
128
37
 
129
- ### Peer Dependencies
130
-
131
- When using OpenTUI features, install the peer dependencies:
132
-
133
- ```bash
134
- bun add @opentui/core @opentui/solid solid-js
135
- ```
136
-
137
- ## System Flags & Configuration
138
-
139
- ArgParser includes built-in `--s-*` flags for development and debugging.
38
+ ### Available Plugins
140
39
 
141
- | Flag | Description |
142
- | ------------------------ | -------------------------------------------------------- |
143
- | `--s-mcp-serve` | Starts the application in MCP server mode. |
144
- | `--s-build-dxt [dir]` | Generates a DXT package for Claude Desktop. |
145
- | `--s-with-env <file>` | Loads configuration from a file (`.env`, `.json`, etc.). |
146
- | `--s-save-to-env <file>` | Saves current arguments to a configuration file. |
147
- | `--s-debug` | Prints a detailed log of the argument parsing process. |
40
+ - `@alcyone-labs/arg-parser-mcp` - MCP server functionality
41
+ - `@alcyone-labs/arg-parser-dxt` - DXT package generation
42
+ - `@alcyone-labs/arg-parser-tui` - Terminal UI with OpenTUI
148
43
 
149
- ## Links
44
+ ## Migration from v2.x
150
45
 
151
- - 📜 **[Changelog](./CHANGELOG.md)**
152
- - 📋 **[Backlog](./BACKLOG.md)**
153
- - 💬 **[Discord Support](https://discord.gg/rRHhpz5nS5)**
46
+ See the [Migration Guide](../../docs/MIGRATION_V3.md) for details on upgrading from v2.x to v3.0.0.
@@ -1,5 +1,37 @@
1
- export { type IConfigPlugin, ConfigPlugin, JsonConfigPlugin, EnvConfigPlugin, } from "./ConfigPlugin";
2
- export { ConfigPluginRegistry, globalConfigPluginRegistry, enableOptionalConfigPlugins, enableOptionalConfigPluginsAsync, enableConfigPlugins, } from "./ConfigPluginRegistry";
3
- export { TomlConfigPlugin, createTomlPlugin, createTomlPluginAsync } from "./TomlConfigPlugin";
4
- export { YamlConfigPlugin, createYamlPlugin, createYamlPluginAsync } from "./YamlConfigPlugin";
1
+ /**
2
+ * Configuration plugin system
3
+ *
4
+ * Provides extensible configuration loading from various sources
5
+ * like JSON files, environment variables, YAML, and TOML.
6
+ */
7
+ export interface IConfigPlugin {
8
+ name: string;
9
+ canLoad(source: string): boolean;
10
+ load(source: string): Promise<Record<string, any>> | Record<string, any>;
11
+ }
12
+ export declare abstract class ConfigPlugin implements IConfigPlugin {
13
+ abstract name: string;
14
+ abstract canLoad(source: string): boolean;
15
+ abstract load(source: string): Promise<Record<string, any>> | Record<string, any>;
16
+ }
17
+ export declare class JsonConfigPlugin extends ConfigPlugin {
18
+ name: string;
19
+ canLoad(source: string): boolean;
20
+ load(source: string): Record<string, any>;
21
+ }
22
+ export declare class EnvConfigPlugin extends ConfigPlugin {
23
+ name: string;
24
+ canLoad(source: string): boolean;
25
+ load(_source: string): Record<string, any>;
26
+ }
27
+ export declare class ConfigPluginRegistry {
28
+ private plugins;
29
+ register(plugin: IConfigPlugin): void;
30
+ get(name: string): IConfigPlugin | undefined;
31
+ findForSource(source: string): IConfigPlugin | undefined;
32
+ }
33
+ export declare const globalConfigPluginRegistry: ConfigPluginRegistry;
34
+ export declare function enableOptionalConfigPlugins(): Promise<void>;
35
+ export declare function enableOptionalConfigPluginsAsync(): Promise<void>;
36
+ export declare function enableConfigPlugins(): void;
5
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/plugins/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,EAC3B,gCAAgC,EAChC,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/plugins/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,IAAI,CAAC,MAAM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