@alcyone-labs/arg-parser 2.2.1 → 2.3.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/README.md +146 -20
- package/dist/assets/.dxtignore.template +0 -1
- package/dist/core/ArgParserBase.d.ts.map +1 -1
- package/dist/dxt/DxtGenerator-testUtils.d.ts +22 -0
- package/dist/dxt/DxtGenerator-testUtils.d.ts.map +1 -0
- package/dist/dxt/DxtGenerator.d.ts +9 -67
- package/dist/dxt/DxtGenerator.d.ts.map +1 -1
- package/dist/index.cjs +367 -1382
- package/dist/index.cjs.map +1 -1
- package/dist/index.min.mjs +6059 -6986
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +367 -1382
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
- package/dist/assets/tsdown.dxt.config.ts +0 -37
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ A modern, type-safe command line argument parser with built-in MCP (Model Contex
|
|
|
10
10
|
- [How to Run It](#how-to-run-it)
|
|
11
11
|
- [Setting Up System-Wide CLI Access](#setting-up-system-wide-cli-access)
|
|
12
12
|
- [Parsing Command-Line Arguments](#parsing-command-line-arguments)
|
|
13
|
+
- [Automatic Argument Detection](#automatic-argument-detection)
|
|
13
14
|
- [Cannonical Usage Pattern](#cannonical-usage-pattern)
|
|
14
15
|
- [Top-level await](#top-level-await)
|
|
15
16
|
- [Promise-based parsing](#promise-based-parsing)
|
|
@@ -36,13 +37,20 @@ A modern, type-safe command line argument parser with built-in MCP (Model Contex
|
|
|
36
37
|
- [Common Pitfalls to Avoid](#common-pitfalls-to-avoid)
|
|
37
38
|
- [Automatic MCP Server Mode (`--s-mcp-serve`)](#automatic-mcp-server-mode---s-mcp-serve)
|
|
38
39
|
- [MCP Transports](#mcp-transports)
|
|
40
|
+
- [MCP Log Path Configuration](#mcp-log-path-configuration)
|
|
39
41
|
- [Automatic Console Safety](#automatic-console-safety)
|
|
40
42
|
- [Generating DXT Packages (`--s-build-dxt`)](#generating-dxt-packages---s-build-dxt)
|
|
41
43
|
- [Logo Configuration](#logo-configuration)
|
|
42
44
|
- [Supported Logo Sources](#supported-logo-sources)
|
|
43
45
|
- [How DXT Generation Works](#how-dxt-generation-works)
|
|
46
|
+
- [DXT Bundling Strategies](#dxt-bundling-strategies)
|
|
44
47
|
- [System Flags & Configuration](#system-flags--configuration)
|
|
45
48
|
- [Changelog](#changelog)
|
|
49
|
+
- [v2.3.0](#v230)
|
|
50
|
+
- [v2.2.1](#v221)
|
|
51
|
+
- [v2.2.0](#v220)
|
|
52
|
+
- [v2.1.1](#v211)
|
|
53
|
+
- [v2.1.0](#v210)
|
|
46
54
|
- [v2.0.0](#v200)
|
|
47
55
|
- [v1.3.0](#v130)
|
|
48
56
|
- [v1.2.0](#v120)
|
|
@@ -57,7 +65,7 @@ A modern, type-safe command line argument parser with built-in MCP (Model Contex
|
|
|
57
65
|
- **Automatic MCP Integration**: Transform any CLI into a compliant MCP server with a single command (`--s-mcp-serve`).
|
|
58
66
|
- **Console Safe**: `console.log` and other methods
|
|
59
67
|
are automatically handled in MCP mode to prevent protocol contamination, requiring no changes to your code.
|
|
60
|
-
- **DXT Package Generation**: Generate complete, ready-to-install Claude Desktop Extension (`.dxt`) packages with the `--s-build-dxt` command.
|
|
68
|
+
- **DXT Package Generation**: Generate complete, ready-to-install Claude Desktop Extension (`.dxt`) packages with the `--s-build-dxt` command and `--s-with-node-modules` for platform-dependent builds.
|
|
61
69
|
- **Hierarchical Sub-commands**: Create complex, nested sub-command structures (e.g., `git commit`, `docker container ls`) with flag inheritance.
|
|
62
70
|
- **Configuration Management**: Easily load (`--s-with-env`) and save (`--s-save-to-env`) configurations from/to `.env`, `.json`, `.yaml`, and `.toml` files.
|
|
63
71
|
- **Automatic Help & Error Handling**: Context-aware help text and user-friendly error messages are generated automatically.
|
|
@@ -162,6 +170,18 @@ mycli --s-mcp-serve
|
|
|
162
170
|
|
|
163
171
|
# 3. Generate a DXT package for Claude Desktop (2-steps)
|
|
164
172
|
mycli --s-build-dxt ./my-dxt-package
|
|
173
|
+
|
|
174
|
+
# If you use ML models or packages that include binaries such as Sqlite3 or sharp, etc...
|
|
175
|
+
# You need to bundle the node_modules folder with your DXT package
|
|
176
|
+
# In order to do this, you need to use the following flag:
|
|
177
|
+
# First hard-install all the packages
|
|
178
|
+
rm -rf node_moduels
|
|
179
|
+
pnpm install --prod --node-linker=hoisted
|
|
180
|
+
# Then bundle with node_modules
|
|
181
|
+
mycli --s-build-dxt ./my-dxt-package --s-with-node-modules
|
|
182
|
+
# then packages the dxt
|
|
183
|
+
npx @anthropic-ai/dxt pack ./my-dxt-package
|
|
184
|
+
# then upload the dxt bundle to Claude Desktop from the settings > extensions > advanced screen
|
|
165
185
|
```
|
|
166
186
|
|
|
167
187
|
Read more on generating the DXT package here: [Generating DXT Packages](#generating-dxt-packages---s-build-dxt)
|
|
@@ -1082,12 +1102,26 @@ my-cli-app --s-build-dxt ./my-dxt-package
|
|
|
1082
1102
|
# A default logo will be applied if you don't provide one.
|
|
1083
1103
|
|
|
1084
1104
|
# 2. (Optional) Pack the folder into a .dxt file for distribution
|
|
1105
|
+
# (you can install the unpacked folder) directly in Claude Desktop > Settings > Extensions > Advanced
|
|
1085
1106
|
npx @anthropic-ai/dxt pack ./my-dxt-package
|
|
1086
1107
|
|
|
1087
|
-
# 3. (Optional) Sign the DXT package
|
|
1108
|
+
# 3. (Optional) Sign the DXT package - this has not been well tested yet
|
|
1088
1109
|
npx @anthropic-ai/dxt sign ./my-dxt-package.dxt
|
|
1089
1110
|
|
|
1090
1111
|
# Then drag & drop the .dxt file into Claude Desktop to install it, in the Settings > Extensions screen.
|
|
1112
|
+
|
|
1113
|
+
# **IMPORTANT**:
|
|
1114
|
+
# If you use ML models or packages that include binaries such as Sqlite3 or sharp, etc...
|
|
1115
|
+
# You need to bundle the node_modules folder with your DXT package
|
|
1116
|
+
# In order to do this, you need to use the following flag:
|
|
1117
|
+
# First hard-install all the packages
|
|
1118
|
+
rm -rf node_moduels
|
|
1119
|
+
pnpm install --prod --linker hoisted
|
|
1120
|
+
# Then bundle with node_modules
|
|
1121
|
+
mycli --s-build-dxt ./my-dxt-package --s-with-node-modules
|
|
1122
|
+
# then build the dxt bundle
|
|
1123
|
+
npx @anthropic-ai/dxt pack ./my-dxt-package
|
|
1124
|
+
# then upload the dxt bundle to Claude Desktop from the settings > extensions > advanced
|
|
1091
1125
|
```
|
|
1092
1126
|
|
|
1093
1127
|
### Logo Configuration
|
|
@@ -1138,37 +1172,129 @@ When you run `--s-build-dxt`, ArgParser performs several steps to create a self-
|
|
|
1138
1172
|
2. **Manifest Generation**: It creates a `manifest.json` file.
|
|
1139
1173
|
- Tool flags are converted into a JSON Schema for the `input_schema`.
|
|
1140
1174
|
- Flags with an `env` property (e.g., `{ name: 'apiKey', env: 'API_KEY' }`) are automatically added to the `user_config` section, prompting the user for the value upon installation and making it available as an environment variable to your tool.
|
|
1141
|
-
3. **Autonomous Build**: It bundles your CLI's source code and its dependencies into a single entry point (e.g., `server.js`) that can run without `node_modules`. This ensures the DXT is portable and reliable.
|
|
1175
|
+
3. **Autonomous Build**: It bundles your CLI's source code and its dependencies into a single entry point (e.g., `server.js`) that can run without `node_modules`. This ensures the DXT is portable and reliable. If you have properly setup your node_modules (via `pnpm install --prod --node-linker=hoisted`) and pass `--s-with-node-nodules` to the bundling process, the resulting DXT will include all necessary dependencies, this is useful for projects that require native dependencies or have complex dependency trees.
|
|
1142
1176
|
4. **Packaging**: It assembles all necessary files (manifest, server bundle, logo, etc.) into the specified output directory, ready to be used by Claude Desktop or packed with `npx @anthropic-ai/dxt`.
|
|
1143
1177
|
|
|
1178
|
+
### DXT Bundling Strategies
|
|
1179
|
+
|
|
1180
|
+
ArgParser offers two approaches for handling dependencies in DXT packages, depending on your project's needs.
|
|
1181
|
+
|
|
1182
|
+
#### Standard Approach (Recommended for Most Projects)
|
|
1183
|
+
|
|
1184
|
+
```bash
|
|
1185
|
+
# For pure JavaScript/TypeScript projects
|
|
1186
|
+
your-cli --s-build-dxt
|
|
1187
|
+
```
|
|
1188
|
+
|
|
1189
|
+
- **Best for**: Pure JS/TS projects without native dependencies
|
|
1190
|
+
- **Bundle size**: Small (5-10MB typical)
|
|
1191
|
+
- **Build time**: Fast
|
|
1192
|
+
- **Dependencies**: Bundled automatically by TSDown
|
|
1193
|
+
|
|
1194
|
+
#### Native Dependencies Approach
|
|
1195
|
+
|
|
1196
|
+
```bash
|
|
1197
|
+
# For projects with native binaries (ONNX, Sharp, SQLite, etc.)
|
|
1198
|
+
rm -rf node_modules
|
|
1199
|
+
pnpm install --prod --node-linker=hoisted
|
|
1200
|
+
your-cli --s-build-dxt --s-with-node-modules
|
|
1201
|
+
```
|
|
1202
|
+
|
|
1203
|
+
- **Best for**: Projects using ONNX Runtime, Sharp, Canvas, SQLite, or other packages with `.node` binaries
|
|
1204
|
+
- **Bundle size**: Larger (50-200MB typical)
|
|
1205
|
+
- **Build time**: Longer (copies entire node_modules)
|
|
1206
|
+
- **Dependencies**: Complete autonomy - no installation needed by Claude
|
|
1207
|
+
|
|
1208
|
+
**When to use `--s-with-node-modules`:**
|
|
1209
|
+
|
|
1210
|
+
- ✅ Your project uses machine learning packages (ONNX Runtime, TensorFlow bindings)
|
|
1211
|
+
- ✅ You need image processing (Sharp, Canvas)
|
|
1212
|
+
- ✅ You use database packages with native binaries (better-sqlite3, sqlite3)
|
|
1213
|
+
- ✅ You want guaranteed compatibility without runtime installation
|
|
1214
|
+
- ✅ Bundle size is acceptable for your use case
|
|
1215
|
+
|
|
1216
|
+
**Required preparation steps:**
|
|
1217
|
+
|
|
1218
|
+
1. `rm -rf node_modules` - Clean slate for proper structure
|
|
1219
|
+
2. `pnpm install --prod --node-linker=hoisted` - Creates flat, symlink-free structure
|
|
1220
|
+
3. Add `--s-with-node-modules` flag to your build command
|
|
1221
|
+
|
|
1222
|
+
The system automatically validates your setup and provides guidance if issues are detected.
|
|
1223
|
+
|
|
1224
|
+
### Typical Errors
|
|
1225
|
+
|
|
1226
|
+
**Failed to run in Claude Desktop**:
|
|
1227
|
+
|
|
1228
|
+
Claude Desktop is pretty finicky (as of Claude 0.12.28), and the built-in Node.js does not work with extensions built with `--s-with-node-modules` and installed via ArgParser (and I have no idea why because there's no debug info).
|
|
1229
|
+
To resolve this, simply go to `Claude Desktop > Settings > Extensions > Advanced Settings` and turn **OFF** `Use Built-in Node.js for MCP`.
|
|
1230
|
+
|
|
1231
|
+
Note that there are _many_ reasons for extensions not to work, if it does not work with Built-in or System Node.js, then something in your app is wrong. Feel free to join Alcyone Labs' discord for support: [Alcyone Labs' Discord](https://discord.gg/rRHhpz5nS5)
|
|
1232
|
+
|
|
1233
|
+
**Failed to attach to MCP when downloading external assets**
|
|
1234
|
+
|
|
1235
|
+
Sometimes, the MCP client needs to install external files, for example an ML model from HuggingFace or some task that takes more than 10 seconds to run. While it's working, Claude Desktop will display a `Cannot attach to MCP`, simply ignore it, Claude Desktop runs a ping every X seconds, and when it is running a long-running task, the ping will fail, but the task itself will still finish correctly.
|
|
1236
|
+
|
|
1237
|
+
**Failed to generate DXT package**:
|
|
1238
|
+
|
|
1239
|
+
If you encounter the following error running a command such as:
|
|
1240
|
+
|
|
1241
|
+
```bash
|
|
1242
|
+
rm -rf node_modules
|
|
1243
|
+
pnpm install --prod --node-linker=hoisted
|
|
1244
|
+
bun src/index.ts --s-build-dxt ./dxt --s-with-node-modules
|
|
1245
|
+
|
|
1246
|
+
-- Error generating DXT package: TSDown DXT build failed: EEXIST: file already exists, mkdir
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
Then run:
|
|
1250
|
+
|
|
1251
|
+
```bash
|
|
1252
|
+
rm -rf ./dxt
|
|
1253
|
+
bun src/index.ts --s-build-dxt ./dxt --s-with-node-modules
|
|
1254
|
+
```
|
|
1255
|
+
|
|
1256
|
+
And it should work. TSDown is tasked to clean the outputDir first, but it won't if some files have been manually changed.
|
|
1257
|
+
|
|
1144
1258
|
---
|
|
1145
1259
|
|
|
1146
1260
|
## System Flags & Configuration
|
|
1147
1261
|
|
|
1148
1262
|
ArgParser includes built-in `--s-*` flags for development, debugging, and configuration. They are processed before normal arguments and will cause the program to exit after their task is complete.
|
|
1149
1263
|
|
|
1150
|
-
| Flag | Description
|
|
1151
|
-
| --------------------------- |
|
|
1152
|
-
| **MCP & DXT** |
|
|
1153
|
-
| `--s-mcp-serve` | Starts the application in MCP server mode, exposing all tools.
|
|
1154
|
-
| `--s-build-dxt [dir]` | Generates a complete, autonomous DXT package for Claude Desktop in the specified directory.
|
|
1155
|
-
| `--s-
|
|
1156
|
-
| `--s-mcp-
|
|
1157
|
-
| `--s-mcp-
|
|
1158
|
-
| `--s-mcp-
|
|
1159
|
-
| `--s-mcp-
|
|
1160
|
-
|
|
|
1161
|
-
|
|
|
1162
|
-
| `--s-
|
|
1163
|
-
|
|
|
1164
|
-
|
|
|
1165
|
-
| `--s-debug
|
|
1166
|
-
| `--s-
|
|
1264
|
+
| Flag | Description |
|
|
1265
|
+
| --------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
1266
|
+
| **MCP & DXT** | |
|
|
1267
|
+
| `--s-mcp-serve` | Starts the application in MCP server mode, exposing all tools. |
|
|
1268
|
+
| `--s-build-dxt [dir]` | Generates a complete, autonomous DXT package for Claude Desktop in the specified directory. |
|
|
1269
|
+
| `--s-with-node-modules` | Use with `--s-build-dxt`. Includes complete node_modules in DXT package for projects with native dependencies. |
|
|
1270
|
+
| `--s-mcp-transport <type>` | Overrides the MCP transport (`stdio`, `sse`, `streamable-http`). |
|
|
1271
|
+
| `--s-mcp-transports <json>` | Overrides transports with a JSON array for multi-transport setups. |
|
|
1272
|
+
| `--s-mcp-port <number>` | Sets the port for HTTP-based transports (`sse`, `streamable-http`). |
|
|
1273
|
+
| `--s-mcp-host <string>` | Sets the host address for HTTP-based transports. |
|
|
1274
|
+
| `--s-mcp-log-path <path>` | Sets the file path for MCP server logs (default: `./logs/mcp.log`). Overrides programmatic setting. |
|
|
1275
|
+
| **Configuration** | |
|
|
1276
|
+
| `--s-with-env <file>` | Loads configuration from a file (`.env`, `.json`, `.yaml`, `.toml`). CLI args take precedence. |
|
|
1277
|
+
| `--s-save-to-env <file>` | Saves the current arguments to a configuration file, perfect for templates. |
|
|
1278
|
+
| **Debugging** | |
|
|
1279
|
+
| `--s-debug` | Prints a detailed, step-by-step log of the argument parsing process. |
|
|
1280
|
+
| `--s-debug-print` | Exports the entire parser configuration to a JSON file for inspection. |
|
|
1281
|
+
| `--s-enable-fuzzy` | Enables fuzzy testing mode—a dry run that parses args but skips handler execution. |
|
|
1167
1282
|
|
|
1168
1283
|
---
|
|
1169
1284
|
|
|
1170
1285
|
## Changelog
|
|
1171
1286
|
|
|
1287
|
+
### v2.3.0
|
|
1288
|
+
|
|
1289
|
+
The DXT bundling is working pretty well now, and we have had a lot of success building, bundling and running various extensions. If you see issues, feel free to open an Issue on GitHub with details, or ask about it on [Alcyone Labs' Discord](https://discord.gg/rRHhpz5nS5)
|
|
1290
|
+
|
|
1291
|
+
Make sure to clearly identify if you need to include the node_modules or not. In doubt, include them using `--s-with-node-modules`
|
|
1292
|
+
|
|
1293
|
+
**Feat**
|
|
1294
|
+
|
|
1295
|
+
- **New `--s-with-node-modules` flag**: Create fully autonomous DXT packages that include complete native dependencies. Perfect for projects using ONNX Runtime, Sharp, SQLite, or other packages with `.node` binaries. Use `rm -rf ./node_modules && pnpm install --prod --node-linker=hoisted` followed by `my-cli --s-build-dxt ./dxt --s-with-node-modules` to create self-contained packages that work without Claude needing to install dependencies.
|
|
1296
|
+
Note that when bundling with node_modules, it's likely that the built-in Node.js will not work with that extension, so go to `Claude Desktop > Settings > Extensions > Advanced Settings` and turn **OFF** `Use Built-in Node.js for MCP`.
|
|
1297
|
+
|
|
1172
1298
|
### v2.2.1
|
|
1173
1299
|
|
|
1174
1300
|
**Feat**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArgParserBase.d.ts","sourceRoot":"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cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAU/C;;OAEG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQrC;;OAEG;IACH,eAAe,IAAI,iBAAiB,EAAE;IAItC;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAM3C;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQnC;;OAEG;IACH,aAAa,IAAI,eAAe,EAAE;IAIlC;;OAEG;IACH,WAAW,CACT,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,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;CA4Z1C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ParseResult } from "../core/types";
|
|
2
|
+
/**
|
|
3
|
+
* Test utilities for DxtGenerator
|
|
4
|
+
* Contains methods that are only used during testing
|
|
5
|
+
*/
|
|
6
|
+
export declare class DxtGeneratorTestUtils {
|
|
7
|
+
private argParserInstance;
|
|
8
|
+
private extractMcpServerInfo;
|
|
9
|
+
private handleExit;
|
|
10
|
+
constructor(argParserInstance: any, extractMcpServerInfo: () => any, handleExit: (exitCode: number, message?: string, type?: ParseResult["type"], data?: any) => ParseResult | never);
|
|
11
|
+
/**
|
|
12
|
+
* Handles DXT generation in test mode by creating mock DXT package structure
|
|
13
|
+
* This method creates simplified mock files for testing purposes
|
|
14
|
+
*/
|
|
15
|
+
handleTestModeDxtGeneration(processArgs: string[], buildDxtIndex: number): Promise<ParseResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Checks if the current environment is in test mode
|
|
18
|
+
* Used to determine whether to use test utilities or production code
|
|
19
|
+
*/
|
|
20
|
+
static isTestMode(): boolean;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=DxtGenerator-testUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DxtGenerator-testUtils.d.ts","sourceRoot":"","sources":["../../src/dxt/DxtGenerator-testUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,iBAAiB,CAAM;IAC/B,OAAO,CAAC,oBAAoB,CAAY;IACxC,OAAO,CAAC,UAAU,CAKO;gBAGvB,iBAAiB,EAAE,GAAG,EACtB,oBAAoB,EAAE,MAAM,GAAG,EAC/B,UAAU,EAAE,CACV,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,IAAI,CAAC,EAAE,GAAG,KACP,WAAW,GAAG,KAAK;IAO1B;;;OAGG;IACU,2BAA2B,CACtC,WAAW,EAAE,MAAM,EAAE,EACrB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,CAAC;IAwFvB;;;OAGG;WACW,UAAU,IAAI,OAAO;CAQpC"}
|
|
@@ -14,87 +14,24 @@ export declare class DxtGenerator {
|
|
|
14
14
|
* Handles the --s-build-dxt system flag to generate DXT packages for MCP servers
|
|
15
15
|
*/
|
|
16
16
|
handleBuildDxtFlag(processArgs: string[], buildDxtIndex: number): Promise<boolean | ParseResult>;
|
|
17
|
-
/**
|
|
18
|
-
* Handles DXT generation in test mode by creating mock DXT package structure
|
|
19
|
-
*/
|
|
20
|
-
private handleTestModeDxtGeneration;
|
|
21
|
-
/**
|
|
22
|
-
* Generates a DXT package for the unified MCP server
|
|
23
|
-
* Now supports both withMcp() configuration and legacy addMcpSubCommand()
|
|
24
|
-
*/
|
|
25
|
-
generateDxtPackage(mcpSubCommand?: any, outputDir?: string): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Reads package.json to extract fallback information for DXT manifest
|
|
28
|
-
*/
|
|
29
|
-
private readPackageJsonInfo;
|
|
30
17
|
/**
|
|
31
18
|
* Extracts server information from MCP configuration
|
|
32
19
|
* Now supports both withMcp() configuration and legacy addMcpSubCommand()
|
|
33
20
|
*/
|
|
34
21
|
private extractMcpServerInfo;
|
|
35
22
|
private generateMcpToolsForDxt;
|
|
36
|
-
private createDxtManifest;
|
|
37
|
-
private validateDxtManifest;
|
|
38
|
-
private createServerScript;
|
|
39
|
-
private createDxtPackageJson;
|
|
40
|
-
/**
|
|
41
|
-
* Creates a .dxtignore file to exclude build artifacts and unnecessary files
|
|
42
|
-
*/
|
|
43
|
-
private createDxtIgnore;
|
|
44
|
-
/**
|
|
45
|
-
* Creates a simple build script that uses TSDown bundling and Anthropic's dxt pack
|
|
46
|
-
*/
|
|
47
|
-
private createSimpleBuildScript;
|
|
48
|
-
private createDxtReadme;
|
|
49
23
|
/**
|
|
50
24
|
* Maps ArgParser flag types to DXT user config types
|
|
51
25
|
*/
|
|
52
|
-
private mapFlagTypeToUserConfigType;
|
|
53
|
-
/**
|
|
54
|
-
* Generates CLI arguments for DXT manifest based on ArgParser flags
|
|
55
|
-
*/
|
|
56
|
-
private generateCliArgsForDxt;
|
|
57
|
-
/**
|
|
58
|
-
* Generates environment variables and user config for DXT manifest
|
|
59
|
-
*/
|
|
60
|
-
private generateEnvAndUserConfig;
|
|
61
|
-
/**
|
|
62
|
-
* Generates a user-friendly title for user config fields
|
|
63
|
-
*/
|
|
64
|
-
private generateUserConfigTitle;
|
|
65
|
-
/**
|
|
66
|
-
* Checks if a field should be marked as sensitive in user config
|
|
67
|
-
*/
|
|
68
|
-
private isSensitiveField;
|
|
69
26
|
/**
|
|
70
27
|
* Adds the logo to the build folder if available
|
|
71
28
|
* @returns The filename of the logo that was added, or undefined if no logo was added
|
|
72
29
|
*/
|
|
73
30
|
private addLogoToFolder;
|
|
74
|
-
/**
|
|
75
|
-
* Processes CLI source code to replace global console with MCP-compliant Logger
|
|
76
|
-
*/
|
|
77
|
-
private processCliSourceForMcp;
|
|
78
|
-
/**
|
|
79
|
-
* Adds the original CLI source to the build folder for handler execution
|
|
80
|
-
*/
|
|
81
|
-
private addOriginalCliToFolder;
|
|
82
31
|
/**
|
|
83
32
|
* Builds a complete DXT package using TSDown CLI for autonomous execution
|
|
84
33
|
*/
|
|
85
34
|
private buildDxtWithTsdown;
|
|
86
|
-
/**
|
|
87
|
-
* Bundles the original CLI using TSDown for autonomous execution (legacy method)
|
|
88
|
-
*/
|
|
89
|
-
private bundleOriginalCliWithTsdown;
|
|
90
|
-
/**
|
|
91
|
-
* Checks if a module ID is a Node.js built-in
|
|
92
|
-
*/
|
|
93
|
-
private isNodeBuiltin;
|
|
94
|
-
/**
|
|
95
|
-
* Gets the TSDown configuration content as a string
|
|
96
|
-
*/
|
|
97
|
-
private getTsdownConfigContent;
|
|
98
35
|
/**
|
|
99
36
|
* Gets the path to the .dxtignore template file in assets
|
|
100
37
|
*/
|
|
@@ -103,13 +40,18 @@ export declare class DxtGenerator {
|
|
|
103
40
|
* Sets up DXT package files (manifest.json) in the output directory
|
|
104
41
|
*/
|
|
105
42
|
private setupDxtPackageFiles;
|
|
106
|
-
/**
|
|
107
|
-
* Manually copy logo since TSDown's copy option doesn't work programmatically
|
|
108
|
-
*/
|
|
109
|
-
private copyLogoManually;
|
|
110
43
|
/**
|
|
111
44
|
* Detects the actual output filename generated by TSDown
|
|
112
45
|
*/
|
|
113
46
|
private detectTsdownOutputFile;
|
|
47
|
+
private findProjectRoot;
|
|
48
|
+
/**
|
|
49
|
+
* Generate environment variables and user configuration from ArgParser flags
|
|
50
|
+
* @returns Object containing envVars and userConfig
|
|
51
|
+
*/
|
|
52
|
+
generateEnvAndUserConfig(): {
|
|
53
|
+
envVars: Record<string, string>;
|
|
54
|
+
userConfig: Record<string, any>;
|
|
55
|
+
};
|
|
114
56
|
}
|
|
115
57
|
//# sourceMappingURL=DxtGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DxtGenerator.d.ts","sourceRoot":"","sources":["../../src/dxt/DxtGenerator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DxtGenerator.d.ts","sourceRoot":"","sources":["../../src/dxt/DxtGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,iBAAiB,CAAM;gBAEnB,iBAAiB,EAAE,GAAG;IAIlC;;OAEG;IACH,OAAO,CAAC,WAAW;IA0BnB;;OAEG;IACU,kBAAkB,CAC7B,WAAW,EAAE,MAAM,EAAE,EACrB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC;IAgJjC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAmC5B,OAAO,CAAC,sBAAsB;IA4F9B;;OAEG;IACH;;;OAGG;YACW,eAAe;IA0J7B;;OAEG;YACW,kBAAkB;IA4MhC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAyChC;;OAEG;YACW,oBAAoB;IAyJlC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA4F9B,OAAO,CAAC,eAAe;IAyBvB;;;OAGG;IACI,wBAAwB,IAAI;QACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACjC;CAsDF"}
|