@alcyone-labs/arg-parser 2.6.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +205 -26
- package/dist/core/ArgParser.d.ts +61 -0
- package/dist/core/ArgParser.d.ts.map +1 -1
- package/dist/core/ArgParserBase.d.ts +20 -0
- package/dist/core/ArgParserBase.d.ts.map +1 -1
- package/dist/index.cjs +259 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.min.mjs +3494 -3335
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +259 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -45,6 +45,9 @@ A modern, type-safe command line argument parser with built-in MCP (Model Contex
|
|
|
45
45
|
- [Common Pitfalls to Avoid](#common-pitfalls-to-avoid)
|
|
46
46
|
- [Automatic MCP Server Mode (`--s-mcp-serve`)](#automatic-mcp-server-mode---s-mcp-serve)
|
|
47
47
|
- [MCP Transports](#mcp-transports)
|
|
48
|
+
- [Adding custom HTTP routes (e.g., /health)](#adding-custom-http-routes-eg-health)
|
|
49
|
+
- [CORS and Authentication for streamable-http](#cors-and-authentication-for-streamable-http)
|
|
50
|
+
- [Multiple transports and improved logging](#multiple-transports-and-improved-logging)
|
|
48
51
|
- [MCP Logging Configuration](#mcp-logging-configuration)
|
|
49
52
|
- [Enhanced Logging (Recommended)](#enhanced-logging-recommended)
|
|
50
53
|
- [Simple Logging Configuration](#simple-logging-configuration)
|
|
@@ -71,6 +74,8 @@ A modern, type-safe command line argument parser with built-in MCP (Model Contex
|
|
|
71
74
|
- [Typical Errors](#typical-errors)
|
|
72
75
|
- [System Flags & Configuration](#system-flags--configuration)
|
|
73
76
|
- [Changelog](#changelog)
|
|
77
|
+
- [v2.7.1](#v271)
|
|
78
|
+
- [v2.7.0](#v270)
|
|
74
79
|
- [v2.6.0](#v260)
|
|
75
80
|
- [v2.5.0](#v250)
|
|
76
81
|
- [v2.4.2](#v242)
|
|
@@ -337,9 +342,9 @@ yarn unlink
|
|
|
337
342
|
|
|
338
343
|
ArgParser's `parse()` method is async and automatically handles both synchronous and asynchronous handlers:
|
|
339
344
|
|
|
340
|
-
###
|
|
345
|
+
### Auto-Execution versus Import: No More Boilerplate
|
|
341
346
|
|
|
342
|
-
|
|
347
|
+
ArgParser now provides auto-execution ability that eliminates the need for boilerplate code to check if your script is being run directly vs. imported. This enables use cases such as programmatically loading the CLI and scanning for tools or testing it from another script via the --s-enable-fuzzy flag or your own script.
|
|
343
348
|
|
|
344
349
|
```typescript
|
|
345
350
|
const cli = ArgParser.withMcp({
|
|
@@ -348,32 +353,26 @@ const cli = ArgParser.withMcp({
|
|
|
348
353
|
handler: async (ctx) => ({ success: true, data: ctx.args }),
|
|
349
354
|
});
|
|
350
355
|
|
|
351
|
-
//
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
const result = await cli.parse(); // No arguments needed!
|
|
356
|
-
console.log("Success:", result);
|
|
357
|
-
} catch (error) {
|
|
358
|
-
console.error("Error:", error.message);
|
|
359
|
-
process.exit(1);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
**How it works:**
|
|
356
|
+
// Now, this will NOT automatically execute the parser if the script is imported, but will execute if called directly:
|
|
357
|
+
await cli.parse(undefined, {
|
|
358
|
+
importMetaUrl: import.meta.url
|
|
359
|
+
}).catch(handleError);
|
|
365
360
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
361
|
+
// Or, using the manual APIs:
|
|
362
|
+
await cli.parseIfExecutedDirectly(import.meta.url).catch((error) => {
|
|
363
|
+
console.error("Fatal error:", error instanceof Error ? error.message : String(error));
|
|
364
|
+
process.exit(1);
|
|
365
|
+
});
|
|
366
|
+
```
|
|
371
367
|
|
|
372
|
-
**
|
|
368
|
+
**Replaces previously confusing patterns:**
|
|
373
369
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
370
|
+
```typescript
|
|
371
|
+
// Brittle and breaks in sandboxes
|
|
372
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
373
|
+
await cli.parse().catch(handleError);
|
|
374
|
+
}
|
|
375
|
+
```
|
|
377
376
|
|
|
378
377
|
### Cannonical Usage Pattern
|
|
379
378
|
|
|
@@ -1296,6 +1295,14 @@ my-tool --s-mcp-serve --s-mcp-transports '[{"type":"stdio"},{"type":"sse","port"
|
|
|
1296
1295
|
# Single transport with custom options
|
|
1297
1296
|
my-tool --s-mcp-serve --s-mcp-transport sse --s-mcp-port 3000 --s-mcp-host 0.0.0.0
|
|
1298
1297
|
|
|
1298
|
+
# Streamable HTTP CORS/auth via CLI flags (JSON strings)
|
|
1299
|
+
my-tool --s-mcp-serve \
|
|
1300
|
+
--s-mcp-transport streamable-http \
|
|
1301
|
+
--s-mcp-port 3002 --s-mcp-path /api/mcp \
|
|
1302
|
+
--s-mcp-cors '{"origins":["http://localhost:5173"],"credentials":true,"methods":["GET","POST","OPTIONS"],"maxAge":600}' \
|
|
1303
|
+
--s-mcp-auth '{"required":true,"scheme":"jwt","jwt":{"algorithms":["HS256"],"secret":"$MY_JWT_SECRET"},"publicPaths":["/health"]}'
|
|
1304
|
+
|
|
1305
|
+
|
|
1299
1306
|
# Custom log path via CLI flag (logs to specified file instead of ./logs/mcp.log)
|
|
1300
1307
|
my-tool --s-mcp-serve --s-mcp-log-path /var/log/my-mcp-server.log
|
|
1301
1308
|
|
|
@@ -1303,6 +1310,130 @@ my-tool --s-mcp-serve --s-mcp-log-path /var/log/my-mcp-server.log
|
|
|
1303
1310
|
const parser = ArgParser.withMcp({
|
|
1304
1311
|
mcp: {
|
|
1305
1312
|
serverInfo: { name: 'my-tool', version: '1.0.0' },
|
|
1313
|
+
|
|
1314
|
+
```
|
|
1315
|
+
|
|
1316
|
+
### CORS and Authentication for streamable-http
|
|
1317
|
+
|
|
1318
|
+
CORS is often required when connecting a Web UI to an MCP server over HTTP.
|
|
1319
|
+
|
|
1320
|
+
- Programmatic transport config:
|
|
1321
|
+
|
|
1322
|
+
```ts
|
|
1323
|
+
import type { McpTransportConfig } from "@alcyone-labs/arg-parser";
|
|
1324
|
+
|
|
1325
|
+
const defaultTransports: McpTransportConfig[] = [{
|
|
1326
|
+
type: "streamable-http",
|
|
1327
|
+
port: 3002,
|
|
1328
|
+
path: "/api/mcp",
|
|
1329
|
+
cors: {
|
|
1330
|
+
origins: ["http://localhost:5173", /^https?:\/\/example\.com$/],
|
|
1331
|
+
methods: ["GET","POST","OPTIONS"],
|
|
1332
|
+
headers: ["Content-Type","Authorization","MCP-Session-Id"],
|
|
1333
|
+
exposedHeaders: ["MCP-Session-Id"],
|
|
1334
|
+
credentials: true,
|
|
1335
|
+
maxAge: 600,
|
|
1336
|
+
},
|
|
1337
|
+
auth: {
|
|
1338
|
+
required: true,
|
|
1339
|
+
scheme: "jwt", // or "bearer"
|
|
1340
|
+
// Bearer allowlist:
|
|
1341
|
+
// allowedTokens: ["token1","token2"],
|
|
1342
|
+
// JWT verification (HS256):
|
|
1343
|
+
// jwt: { algorithms: ["HS256"], secret: process.env.JWT_SECRET },
|
|
1344
|
+
// JWT verification (RS256 with static public key):
|
|
1345
|
+
// jwt: { algorithms: ["RS256"], publicKey: process.env.RS256_PUBLIC_KEY },
|
|
1346
|
+
// JWT verification (RS256 with dynamic JWKS):
|
|
1347
|
+
// jwt: { algorithms: ["RS256"], getPublicKey: async (header)=>{ /* fetch JWKS and return PEM */ } },
|
|
1348
|
+
publicPaths: ["/health"],
|
|
1349
|
+
protectedPaths: undefined, // if set, only listed paths require auth
|
|
1350
|
+
// Optional custom validator to add extra checks
|
|
1351
|
+
validator: async (req, token) => true,
|
|
1352
|
+
},
|
|
1353
|
+
}];
|
|
1354
|
+
```
|
|
1355
|
+
|
|
1356
|
+
- CLI flags (JSON strings):
|
|
1357
|
+
|
|
1358
|
+
```bash
|
|
1359
|
+
my-tool --s-mcp-serve \
|
|
1360
|
+
--s-mcp-transport streamable-http \
|
|
1361
|
+
--s-mcp-port 3002 --s-mcp-path /api/mcp \
|
|
1362
|
+
--s-mcp-cors '{"origins":["http://localhost:5173"],"credentials":true,"methods":["GET","POST","OPTIONS"],"maxAge":600}' \
|
|
1363
|
+
--s-mcp-auth '{"required":true,"scheme":"jwt","jwt":{"algorithms":["HS256"],"secret":"'$JWT_SECRET'"},"publicPaths":["/health"]}'
|
|
1364
|
+
```
|
|
1365
|
+
|
|
1366
|
+
- Express hook for custom routes:
|
|
1367
|
+
|
|
1368
|
+
```ts
|
|
1369
|
+
httpServer: {
|
|
1370
|
+
configureExpress: (app) => {
|
|
1371
|
+
app.get("/health", (_req, res) => res.json({ ok: true }));
|
|
1372
|
+
},
|
|
1373
|
+
}
|
|
1374
|
+
```
|
|
1375
|
+
|
|
1376
|
+
See examples:
|
|
1377
|
+
- examples/streamable-http/secure-mcp.ts (HS256)
|
|
1378
|
+
- examples/streamable-http/rs256-mcp.ts (RS256)
|
|
1379
|
+
- examples/streamable-http/jwks-mcp.ts (JWKS)
|
|
1380
|
+
- examples/streamable-http/bearer-mcp.ts (Bearer)
|
|
1381
|
+
- examples/streamable-http/productized-mcp.ts (token + session usage)
|
|
1382
|
+
|
|
1383
|
+
#### TypeScript types
|
|
1384
|
+
|
|
1385
|
+
- CorsOptions
|
|
1386
|
+
|
|
1387
|
+
```ts
|
|
1388
|
+
export type CorsOptions = {
|
|
1389
|
+
origins?: "*" | string | RegExp | Array<string | RegExp>;
|
|
1390
|
+
methods?: string[];
|
|
1391
|
+
headers?: string[];
|
|
1392
|
+
exposedHeaders?: string[];
|
|
1393
|
+
credentials?: boolean;
|
|
1394
|
+
maxAge?: number;
|
|
1395
|
+
};
|
|
1396
|
+
```
|
|
1397
|
+
|
|
1398
|
+
- AuthOptions and JwtVerifyOptions
|
|
1399
|
+
|
|
1400
|
+
```ts
|
|
1401
|
+
export type JwtVerifyOptions = {
|
|
1402
|
+
algorithms?: ("HS256" | "RS256")[];
|
|
1403
|
+
secret?: string; // HS256
|
|
1404
|
+
publicKey?: string; // RS256 static
|
|
1405
|
+
getPublicKey?: (header: Record<string, unknown>, payload: Record<string, unknown>) => Promise<string> | string; // RS256 dynamic
|
|
1406
|
+
audience?: string | string[];
|
|
1407
|
+
issuer?: string | string[];
|
|
1408
|
+
clockToleranceSec?: number;
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
export type AuthOptions = {
|
|
1412
|
+
required?: boolean; // default true for MCP endpoint
|
|
1413
|
+
scheme?: "bearer" | "jwt";
|
|
1414
|
+
allowedTokens?: string[]; // simple bearer allowlist
|
|
1415
|
+
validator?: (req: any, token: string | undefined) => boolean | Promise<boolean>;
|
|
1416
|
+
jwt?: JwtVerifyOptions;
|
|
1417
|
+
publicPaths?: string[]; // paths that skip auth
|
|
1418
|
+
protectedPaths?: string[]; // if provided, only these paths require auth
|
|
1419
|
+
customMiddleware?: (req: any, res: any, next: any) => any; // full control hook
|
|
1420
|
+
};
|
|
1421
|
+
```
|
|
1422
|
+
|
|
1423
|
+
- HttpServerOptions
|
|
1424
|
+
|
|
1425
|
+
```ts
|
|
1426
|
+
export type HttpServerOptions = {
|
|
1427
|
+
configureExpress?: (app: any) => void;
|
|
1428
|
+
};
|
|
1429
|
+
```
|
|
1430
|
+
|
|
1431
|
+
Notes:
|
|
1432
|
+
- When credentials are true, Access-Control-Allow-Origin echoes the request Origin rather than using "*".
|
|
1433
|
+
- You can manage CORS for non-MCP routes in configureExpress.
|
|
1434
|
+
- Use publicPaths to allow some routes without auth; use protectedPaths to only require auth for certain routes.
|
|
1435
|
+
|
|
1436
|
+
|
|
1306
1437
|
log: {
|
|
1307
1438
|
level: 'debug', // Capture all log levels
|
|
1308
1439
|
logToFile: '/var/log/my-mcp-server.log',
|
|
@@ -1310,9 +1441,28 @@ const parser = ArgParser.withMcp({
|
|
|
1310
1441
|
}
|
|
1311
1442
|
// LEGACY: logPath: '/var/log/my-mcp-server.log' // Still works
|
|
1312
1443
|
}
|
|
1444
|
+
|
|
1445
|
+
### Adding custom HTTP routes (e.g., /health)
|
|
1446
|
+
|
|
1447
|
+
Use the httpServer.configureExpress(app) hook to register routes before MCP endpoints are bound. Example:
|
|
1448
|
+
|
|
1449
|
+
```ts
|
|
1450
|
+
const cli = ArgParser.withMcp({
|
|
1451
|
+
mcp: {
|
|
1452
|
+
serverInfo: { name: "my-mcp", version: "1.0.0" },
|
|
1453
|
+
defaultTransports: [
|
|
1454
|
+
{ type: "streamable-http", port: 3002, path: "/api/mcp", auth: { required: true, publicPaths: ["/health"] } }
|
|
1455
|
+
],
|
|
1456
|
+
httpServer: { configureExpress: (app) => app.get("/health", (_req, res) => res.json({ ok: true })) },
|
|
1457
|
+
}
|
|
1313
1458
|
});
|
|
1459
|
+
```
|
|
1460
|
+
|
|
1461
|
+
- To make a route public (no auth), add it to auth.publicPaths.
|
|
1462
|
+
- CORS headers for non-MCP paths can be applied by your own middleware inside the hook if desired.
|
|
1463
|
+
|
|
1464
|
+
### Multiple transports and improved logging
|
|
1314
1465
|
|
|
1315
|
-
# Multiple transports and improved logging (configured via --s-mcp-serve system flag)
|
|
1316
1466
|
const cli = ArgParser.withMcp({
|
|
1317
1467
|
appName: 'multi-tool',
|
|
1318
1468
|
appCommandName: 'multi-tool',
|
|
@@ -1914,6 +2064,35 @@ ArgParser includes built-in `--s-*` flags for development, debugging, and config
|
|
|
1914
2064
|
|
|
1915
2065
|
## Changelog
|
|
1916
2066
|
|
|
2067
|
+
### v2.7.1
|
|
2068
|
+
|
|
2069
|
+
**Feat**
|
|
2070
|
+
|
|
2071
|
+
**MCP**:
|
|
2072
|
+
|
|
2073
|
+
- outputSchema is now included in MCP tool registration for MCP 2025-06-18+ clients and will generate a JSON Schema in `tools/list` responses to make JSON introspection easier.
|
|
2074
|
+
|
|
2075
|
+
**Fixes and Changes**
|
|
2076
|
+
|
|
2077
|
+
**MCP**:
|
|
2078
|
+
|
|
2079
|
+
- The app parameter in configureExpress: (app) => {} is now fully typed to improve intellisense.
|
|
2080
|
+
- Express' x-powered-by was disabled by default. It can be re-enabled or changed via configureExpress as needed.
|
|
2081
|
+
- Logger parameters were still not fully functional and log level was still ignored, this has been fixed.
|
|
2082
|
+
|
|
2083
|
+
### v2.7.0
|
|
2084
|
+
|
|
2085
|
+
**Feat**
|
|
2086
|
+
|
|
2087
|
+
**MCP**:
|
|
2088
|
+
|
|
2089
|
+
- Add support for CORS and authentication options, enabling powerful tools to serve Web UIs and publicly exposed APIs
|
|
2090
|
+
- Add supports for configuring express by exposing the app before it runs
|
|
2091
|
+
|
|
2092
|
+
**CLI**:
|
|
2093
|
+
|
|
2094
|
+
- Add support for NOT automatically executing the CLI if the script is imported, but will execute if called directly as a CLI. This enables use cases such as programmatically loading the CLI and scanning for tools or testing it from another script via the --s-enable-fuzzy flag or your own script.
|
|
2095
|
+
|
|
1917
2096
|
### v2.6.0
|
|
1918
2097
|
|
|
1919
2098
|
**Feat**
|
package/dist/core/ArgParser.d.ts
CHANGED
|
@@ -4,15 +4,45 @@ import type { McpLifecycleEvents } from "../mcp/mcp-lifecycle";
|
|
|
4
4
|
import { ArgParserBase, type IArgParserParams } from "./ArgParserBase";
|
|
5
5
|
import { type LogPath } from "./log-path-utils";
|
|
6
6
|
import type { IFlag, IHandlerContext, OutputSchemaConfig } from "./types";
|
|
7
|
+
import type { Application as ExpressApplication } from "express";
|
|
7
8
|
/**
|
|
8
9
|
* Configuration for a single MCP transport
|
|
9
10
|
*/
|
|
11
|
+
export type CorsOptions = {
|
|
12
|
+
origins?: "*" | string | RegExp | Array<string | RegExp>;
|
|
13
|
+
methods?: string[];
|
|
14
|
+
headers?: string[];
|
|
15
|
+
exposedHeaders?: string[];
|
|
16
|
+
credentials?: boolean;
|
|
17
|
+
maxAge?: number;
|
|
18
|
+
};
|
|
19
|
+
export type JwtVerifyOptions = {
|
|
20
|
+
algorithms?: ("HS256" | "RS256")[];
|
|
21
|
+
secret?: string;
|
|
22
|
+
publicKey?: string;
|
|
23
|
+
getPublicKey?: (header: Record<string, unknown>, payload: Record<string, unknown>) => Promise<string> | string;
|
|
24
|
+
audience?: string | string[];
|
|
25
|
+
issuer?: string | string[];
|
|
26
|
+
clockToleranceSec?: number;
|
|
27
|
+
};
|
|
28
|
+
export type AuthOptions = {
|
|
29
|
+
required?: boolean;
|
|
30
|
+
scheme?: "bearer" | "jwt";
|
|
31
|
+
allowedTokens?: string[];
|
|
32
|
+
validator?: (req: any, token: string | undefined) => boolean | Promise<boolean>;
|
|
33
|
+
jwt?: JwtVerifyOptions;
|
|
34
|
+
publicPaths?: string[];
|
|
35
|
+
protectedPaths?: string[];
|
|
36
|
+
customMiddleware?: (req: any, res: any, next: any) => any;
|
|
37
|
+
};
|
|
10
38
|
export type McpTransportConfig = {
|
|
11
39
|
type: "stdio" | "sse" | "streamable-http";
|
|
12
40
|
port?: number;
|
|
13
41
|
host?: string;
|
|
14
42
|
path?: string;
|
|
15
43
|
sessionIdGenerator?: () => string;
|
|
44
|
+
cors?: CorsOptions;
|
|
45
|
+
auth?: AuthOptions;
|
|
16
46
|
};
|
|
17
47
|
/**
|
|
18
48
|
* Configuration options for MCP sub-command
|
|
@@ -100,6 +130,9 @@ export type DxtOptions = {
|
|
|
100
130
|
* MCP server configuration options for withMcp() method
|
|
101
131
|
* This centralizes MCP server metadata that was previously scattered across addMcpSubCommand calls
|
|
102
132
|
*/
|
|
133
|
+
export type HttpServerOptions = {
|
|
134
|
+
configureExpress?: (app: ExpressApplication) => void;
|
|
135
|
+
};
|
|
103
136
|
export type McpServerOptions = {
|
|
104
137
|
/** MCP server metadata */
|
|
105
138
|
serverInfo?: DxtServerInfo;
|
|
@@ -141,6 +174,8 @@ export type McpServerOptions = {
|
|
|
141
174
|
lifecycle?: McpLifecycleEvents;
|
|
142
175
|
/** DXT package configuration options */
|
|
143
176
|
dxt?: DxtOptions;
|
|
177
|
+
/** Optional HTTP server configuration hooks */
|
|
178
|
+
httpServer?: HttpServerOptions;
|
|
144
179
|
};
|
|
145
180
|
/**
|
|
146
181
|
* Combined options for withMcp() method
|
|
@@ -384,6 +419,8 @@ export declare class ArgParser<THandlerReturn = any> extends ArgParserBase<THand
|
|
|
384
419
|
host?: string;
|
|
385
420
|
path?: string;
|
|
386
421
|
sessionIdGenerator?: () => string;
|
|
422
|
+
cors?: CorsOptions;
|
|
423
|
+
auth?: AuthOptions;
|
|
387
424
|
}>, toolOptions?: GenerateMcpToolsOptions, logPath?: LogPath): Promise<void>;
|
|
388
425
|
/**
|
|
389
426
|
* Start an MCP server with a specific transport type
|
|
@@ -402,6 +439,8 @@ export declare class ArgParser<THandlerReturn = any> extends ArgParserBase<THand
|
|
|
402
439
|
host?: string;
|
|
403
440
|
path?: string;
|
|
404
441
|
sessionIdGenerator?: () => string;
|
|
442
|
+
cors?: CorsOptions;
|
|
443
|
+
auth?: AuthOptions;
|
|
405
444
|
}, toolOptions?: GenerateMcpToolsOptions, logPath?: LogPath): Promise<void>;
|
|
406
445
|
parse(processArgs?: string[], options?: any): Promise<any>;
|
|
407
446
|
/**
|
|
@@ -417,6 +456,28 @@ export declare class ArgParser<THandlerReturn = any> extends ArgParserBase<THand
|
|
|
417
456
|
* @deprecated Use parse() instead. This method will be removed in a future version.
|
|
418
457
|
*/
|
|
419
458
|
parseAsync(processArgs?: string[], options?: any): Promise<any>;
|
|
459
|
+
/**
|
|
460
|
+
* Convenience method for auto-execution: only runs if the script is executed directly (not imported).
|
|
461
|
+
* This eliminates the need for boilerplate code to check if the script is being run directly.
|
|
462
|
+
*
|
|
463
|
+
* @param importMetaUrl Pass import.meta.url from your script for reliable detection
|
|
464
|
+
* @param processArgs Optional arguments to parse (defaults to process.argv.slice(2))
|
|
465
|
+
* @param options Additional parse options
|
|
466
|
+
* @returns Promise that resolves to the parse result, or empty object if script is imported
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```typescript
|
|
470
|
+
* // At the bottom of your CLI script:
|
|
471
|
+
* await cli.parseIfExecutedDirectly(import.meta.url);
|
|
472
|
+
*
|
|
473
|
+
* // With error handling:
|
|
474
|
+
* await cli.parseIfExecutedDirectly(import.meta.url).catch((error) => {
|
|
475
|
+
* console.error("Fatal error:", error instanceof Error ? error.message : String(error));
|
|
476
|
+
* process.exit(1);
|
|
477
|
+
* });
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
parseIfExecutedDirectly(importMetaUrl: string, processArgs?: string[], options?: any): Promise<any>;
|
|
420
481
|
/**
|
|
421
482
|
* Add an MCP sub-command that starts an MCP server exposing this parser's functionality
|
|
422
483
|
* @param subCommandName Name of the sub-command (default: "mcp-server")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArgParser.d.ts","sourceRoot":"","sources":["../../src/core/ArgParser.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,iCAAiC,CAAC;AAOzC,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAW/D,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,kBAAkB,EAEnB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ArgParser.d.ts","sourceRoot":"","sources":["../../src/core/ArgParser.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,iCAAiC,CAAC;AAOzC,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAW/D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,EAAE,qBAAqB,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,EACxD,YAAY,CAAC,EAAE,qBAAqB,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,GAC5D,SAAS,CAAC,CAAC,CAAC;WASD,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;CA+B7E"}
|
|
@@ -98,6 +98,19 @@ export interface IParseOptions {
|
|
|
98
98
|
* @internal
|
|
99
99
|
*/
|
|
100
100
|
isMcp?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* When true, automatically executes the CLI if the script is being run directly (not imported).
|
|
103
|
+
* When false, disables auto-execution detection even if importMetaUrl is provided.
|
|
104
|
+
* Uses robust detection that works across different environments and sandboxes.
|
|
105
|
+
* Only takes effect when importMetaUrl is also provided.
|
|
106
|
+
* @default true (when importMetaUrl is provided)
|
|
107
|
+
*/
|
|
108
|
+
autoExecute?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* The import.meta.url from the calling script, required for reliable auto-execution detection.
|
|
111
|
+
* Only used when autoExecute is true.
|
|
112
|
+
*/
|
|
113
|
+
importMetaUrl?: string;
|
|
101
114
|
}
|
|
102
115
|
type TParsedArgsWithRouting<T = any> = T & {
|
|
103
116
|
$commandChain?: string[];
|
|
@@ -137,6 +150,13 @@ export declare class ArgParserBase<THandlerReturn = any> {
|
|
|
137
150
|
*/
|
|
138
151
|
setHandler(handler: (ctx: IHandlerContext<any, any>) => THandlerReturn | Promise<THandlerReturn>): this;
|
|
139
152
|
printAll(filePath?: string): void;
|
|
153
|
+
/**
|
|
154
|
+
* Detects if the current script is being executed directly (not imported)
|
|
155
|
+
* Uses a robust method that works across different environments and sandboxes
|
|
156
|
+
* @param importMetaUrl The import.meta.url from the calling script (optional)
|
|
157
|
+
* @returns true if the script is being executed directly, false if imported
|
|
158
|
+
*/
|
|
159
|
+
private static isExecutedDirectly;
|
|
140
160
|
parse(processArgs?: string[], options?: IParseOptions): Promise<TParsedArgsWithRouting<any> | ParseResult>;
|
|
141
161
|
/**
|
|
142
162
|
* Alias for parse() method for backward compatibility
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArgParserBase.d.ts","sourceRoot":"","sources":["../../src/core/ArgParserBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ArgParserBase.d.ts","sourceRoot":"","sources":["../../src/core/ArgParserBase.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,EACb,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,WAAW,EACX,WAAW,EACX,aAAa,EACb,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,qBAAa,cAAe,SAAQ,KAAK;IAI9B,QAAQ,EAAE,MAAM,EAAE;IAHpB,YAAY,EAAE,MAAM,EAAE,CAAC;gBAE5B,OAAO,EAAE,MAAM,EACR,QAAQ,GAAE,MAAM,EAAO;CAMjC;AAED,MAAM,WAAW,gBAAgB,CAAC,cAAc,GAAG,GAAG;IACpD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,CACR,GAAG,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,KAC3B,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE9C;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;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