@alcyone-labs/arg-parser 2.2.1 → 2.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-integration.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-integration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,KAAK,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EACV,KAAK,EAEL,aAAa,EACb,WAAW,EACZ,MAAM,eAAe,CAAC;AASvB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,GAAG,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,GAAG,GAAG,WAAW,CAS/D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,WAAW,CAazE;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,KAAK,GAAG,aAAa,GAAG;IAC5E,QAAQ,EAAE,GAAG,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;CACrB,CAkCA;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,SAAS,CAAC,KAAK,GAAG,aAAa,CAAC,EAAE,GACxC;IACD,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAuBA;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,CAA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,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,wBAAwB;IAChC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC1D,eAAe,CAAC,EAAE,GAAG,CAAC;CACvB;AACD,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,aAAa,EAAE,CAAC,GAC9D,wBAAwB,CAAC;AAE3B,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,aAAa,EACzB,OAAO,CAAC,EAAE,uBAAuB,GAChC,iBAAiB,EAAE,CAu3BrB"}
@@ -0,0 +1,163 @@
1
+ /**
2
+ * MCP Lifecycle Events System
3
+ *
4
+ * This module provides lifecycle event hooks for MCP servers, allowing applications
5
+ * to perform initialization, cleanup, and other lifecycle-related operations at
6
+ * specific points in the MCP protocol flow.
7
+ */
8
+ /**
9
+ * Base context interface shared by all lifecycle events
10
+ */
11
+ export interface McpLifecycleBaseContext {
12
+ /** Get a parsed flag value by name */
13
+ getFlag(name: string): any;
14
+ /** MCP logger instance for this context */
15
+ logger: any;
16
+ /** Server information */
17
+ serverInfo: {
18
+ name: string;
19
+ version: string;
20
+ description?: string;
21
+ };
22
+ }
23
+ /**
24
+ * Context provided during the MCP initialize request
25
+ * This is called when a client sends the "initialize" request
26
+ */
27
+ export interface McpInitializeContext extends McpLifecycleBaseContext {
28
+ /** Client information from the initialize request */
29
+ clientInfo: {
30
+ name: string;
31
+ version: string;
32
+ title?: string;
33
+ };
34
+ /** Protocol version being used */
35
+ protocolVersion: string;
36
+ /** Client capabilities */
37
+ clientCapabilities: Record<string, any>;
38
+ }
39
+ /**
40
+ * Context provided after the MCP initialized notification
41
+ * This is called when a client sends the "initialized" notification
42
+ */
43
+ export interface McpInitializedContext extends McpLifecycleBaseContext {
44
+ /** Client information from the previous initialize request */
45
+ clientInfo: {
46
+ name: string;
47
+ version: string;
48
+ title?: string;
49
+ };
50
+ /** Protocol version being used */
51
+ protocolVersion: string;
52
+ }
53
+ /**
54
+ * Context provided during server shutdown
55
+ * This is called when the MCP server is being shut down
56
+ */
57
+ export interface McpShutdownContext extends McpLifecycleBaseContext {
58
+ /** Reason for shutdown */
59
+ reason: "client_disconnect" | "server_shutdown" | "error" | "signal";
60
+ /** Optional error if shutdown was due to an error */
61
+ error?: Error;
62
+ }
63
+ /**
64
+ * Lifecycle event handlers interface
65
+ */
66
+ export interface McpLifecycleEvents {
67
+ /**
68
+ * Called when a client sends an "initialize" request
69
+ * This is the first lifecycle event and is ideal for:
70
+ * - Database connection setup
71
+ * - Resource initialization
72
+ * - Configuration validation
73
+ * - Authentication setup
74
+ */
75
+ onInitialize?: (context: McpInitializeContext) => Promise<void>;
76
+ /**
77
+ * Called when a client sends an "initialized" notification
78
+ * This indicates the client is ready for normal operations
79
+ * This is ideal for:
80
+ * - Final setup steps
81
+ * - Background task initialization
82
+ * - Health checks
83
+ */
84
+ onInitialized?: (context: McpInitializedContext) => Promise<void>;
85
+ /**
86
+ * Called when the MCP server is shutting down
87
+ * This is ideal for:
88
+ * - Database connection cleanup
89
+ * - Resource disposal
90
+ * - Graceful shutdown procedures
91
+ */
92
+ onShutdown?: (context: McpShutdownContext) => Promise<void>;
93
+ }
94
+ /**
95
+ * Internal state tracking for lifecycle events
96
+ */
97
+ export interface McpLifecycleState {
98
+ /** Whether the initialize event has been called */
99
+ initialized: boolean;
100
+ /** Whether the initialized event has been called */
101
+ ready: boolean;
102
+ /** Whether shutdown has been initiated */
103
+ shuttingDown: boolean;
104
+ /** Stored client info from initialize */
105
+ clientInfo?: {
106
+ name: string;
107
+ version: string;
108
+ title?: string;
109
+ };
110
+ /** Protocol version being used */
111
+ protocolVersion?: string;
112
+ /** Client capabilities */
113
+ clientCapabilities?: Record<string, any>;
114
+ }
115
+ /**
116
+ * Lifecycle manager class for handling MCP lifecycle events
117
+ */
118
+ export declare class McpLifecycleManager {
119
+ private events;
120
+ private logger;
121
+ private serverInfo;
122
+ private argParser?;
123
+ private state;
124
+ private parsedArgs;
125
+ constructor(events: McpLifecycleEvents, logger: any, serverInfo: {
126
+ name: string;
127
+ version: string;
128
+ description?: string;
129
+ }, argParser?: any | undefined);
130
+ /**
131
+ * Set the parsed arguments for flag access
132
+ */
133
+ setParsedArgs(parsedArgs: any): void;
134
+ /**
135
+ * Get a flag value from parsed arguments or environment variables
136
+ */
137
+ private getFlag;
138
+ /**
139
+ * Handle the initialize request
140
+ */
141
+ handleInitialize(clientInfo: {
142
+ name: string;
143
+ version: string;
144
+ title?: string;
145
+ }, protocolVersion: string, clientCapabilities: Record<string, any>): Promise<void>;
146
+ /**
147
+ * Handle the initialized notification
148
+ */
149
+ handleInitialized(): Promise<void>;
150
+ /**
151
+ * Handle server shutdown
152
+ */
153
+ handleShutdown(reason: "client_disconnect" | "server_shutdown" | "error" | "signal", error?: Error): Promise<void>;
154
+ /**
155
+ * Get current lifecycle state
156
+ */
157
+ getState(): Readonly<McpLifecycleState>;
158
+ /**
159
+ * Check if the server is ready for operations
160
+ */
161
+ isReady(): boolean;
162
+ }
163
+ //# sourceMappingURL=mcp-lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-lifecycle.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,sCAAsC;IACtC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IAC3B,2CAA2C;IAC3C,MAAM,EAAE,GAAG,CAAC;IACZ,yBAAyB;IACzB,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,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AAE,mBAAmB,GAAG,iBAAiB,GAAG,OAAO,GAAG,QAAQ,EACpE,KAAK,CAAC,EAAE,KAAK,GACZ,OAAO,CAAC,IAAI,CAAC;IA4BhB;;OAEG;IACH,QAAQ,IAAI,QAAQ,CAAC,iBAAiB,CAAC;IAIvC;;OAEG;IACH,OAAO,IAAI,OAAO;CAGnB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Utilities for MCP (Model Context Protocol) compatibility
3
+ */
4
+ /**
5
+ * Sanitizes a tool name to comply with MCP naming requirements.
6
+ * MCP tool names must match the pattern: ^[a-zA-Z0-9_-]{1,64}$
7
+ *
8
+ * @param name The original tool name
9
+ * @returns A sanitized tool name that complies with MCP requirements
10
+ */
11
+ export declare function sanitizeMcpToolName(name: string): string;
12
+ /**
13
+ * Validates if a tool name complies with MCP naming requirements.
14
+ * MCP tool names must match the pattern: ^[a-zA-Z0-9_-]{1,64}$
15
+ *
16
+ * @param name The tool name to validate
17
+ * @returns True if the name is valid, false otherwise
18
+ */
19
+ export declare function isValidMcpToolName(name: string): boolean;
20
+ //# sourceMappingURL=mcp-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-utils.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBxD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOxD"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Zod v3/v4 compatibility layer for MCP SDK integration
3
+ *
4
+ * The MCP SDK currently expects Zod v3 "raw shape" types for input schemas,
5
+ * but this project uses Zod v4. This module provides compatibility functions
6
+ * to convert Zod v4 schemas to formats that the MCP SDK can understand.
7
+ */
8
+ import { type ZodObject, type ZodRawShape, type ZodTypeAny } from "zod";
9
+ /**
10
+ * Type representing a Zod v3 compatible raw shape
11
+ */
12
+ type ZodV3CompatibleShape = Record<string, ZodTypeAny>;
13
+ /**
14
+ * Type representing what the MCP SDK expects for tool registration
15
+ */
16
+ interface McpSdkCompatibleSchema {
17
+ shape?: ZodV3CompatibleShape;
18
+ _def?: any;
19
+ _zod?: any;
20
+ parse?: (input: any) => any;
21
+ safeParse?: (input: any) => any;
22
+ }
23
+ /**
24
+ * Converts a Zod v4 schema to a format compatible with the MCP SDK's expectations
25
+ * for Zod v3 raw shape types.
26
+ *
27
+ * @param zodSchema - The Zod v4 schema to convert
28
+ * @returns A schema format compatible with MCP SDK
29
+ */
30
+ export declare function convertToMcpCompatibleSchema(zodSchema: ZodTypeAny): McpSdkCompatibleSchema;
31
+ /**
32
+ * Creates an empty schema compatible with MCP SDK for tools with no parameters
33
+ */
34
+ export declare function createEmptyMcpSchema(): McpSdkCompatibleSchema;
35
+ /**
36
+ * Extracts the raw shape from a Zod v4 object schema in a way that's
37
+ * compatible with what MCP SDK expects from Zod v3.
38
+ *
39
+ * @param zodObjectSchema - A Zod object schema
40
+ * @returns The raw shape or empty object if extraction fails
41
+ */
42
+ export declare function extractRawShape(zodObjectSchema: ZodObject<ZodRawShape>): ZodV3CompatibleShape;
43
+ /**
44
+ * Checks if a schema is a Zod object schema
45
+ */
46
+ export declare function isZodObjectSchema(schema: any): schema is ZodObject<ZodRawShape>;
47
+ /**
48
+ * Converts Zod v4 schemas to the specific format expected by MCP SDK tool registration.
49
+ * This function handles the conversion for the server.registerTool() call.
50
+ *
51
+ * @param zodSchema - The Zod v4 schema to convert
52
+ * @returns A schema format that MCP SDK can work with
53
+ */
54
+ export declare function prepareMcpToolSchema(zodSchema: ZodTypeAny): any;
55
+ /**
56
+ * Simple approach: Create a clean copy of Zod schema without v4-specific properties
57
+ * This is a non-recursive version to avoid infinite loops
58
+ */
59
+ export declare function createCleanZodSchema(zodSchema: ZodTypeAny): any;
60
+ /**
61
+ * Convert a Zod schema to a JSON Schema object that the MCP SDK expects
62
+ * This is the correct approach - the MCP SDK expects JSON Schema, not Zod schemas
63
+ */
64
+ export declare function zodToJsonSchema(zodSchema: ZodTypeAny): any;
65
+ /**
66
+ * Debug function to log schema structure for troubleshooting
67
+ */
68
+ export declare function debugSchemaStructure(schema: any, label?: string): void;
69
+ /**
70
+ * Validates that a schema is compatible with MCP SDK expectations
71
+ */
72
+ export declare function validateMcpSchemaCompatibility(schema: any): boolean;
73
+ export {};
74
+ //# sourceMappingURL=zod-compatibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod-compatibility.d.ts","sourceRoot":"","sources":["../../src/mcp/zod-compatibility.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAK,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAE3E;;GAEG;AACH,KAAK,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAEvD;;GAEG;AACH,UAAU,sBAAsB;IAC9B,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAC5B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,UAAU,GACpB,sBAAsB,CAwDxB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,sBAAsB,CAG7D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,eAAe,EAAE,SAAS,CAAC,WAAW,CAAC,GACtC,oBAAoB,CA6CtB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,GAAG,GACV,MAAM,IAAI,SAAS,CAAC,WAAW,CAAC,CAWlC;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,UAAU,GAAG,GAAG,CA6G/D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,UAAU,GAAG,GAAG,CA6C/D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,UAAU,GAAG,GAAG,CA4D1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,GAAG,EACX,KAAK,GAAE,MAAiB,GACvB,IAAI,CAgBN;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAiCnE"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Debug utility for conditional logging based on environment variables
3
+ *
4
+ * This utility provides clean debug logging without scattered conditional statements.
5
+ * Debug output is controlled by the DEBUG environment variable.
6
+ */
7
+ /**
8
+ * Debug logger that only outputs when DEBUG environment variable is set
9
+ */
10
+ export declare const debug: {
11
+ /**
12
+ * Log a debug message to stderr (only when DEBUG=true)
13
+ */
14
+ log: (...args: any[]) => void;
15
+ /**
16
+ * Log an error debug message to stderr (only when DEBUG=true)
17
+ */
18
+ error: (...args: any[]) => void;
19
+ /**
20
+ * Log a warning debug message to stderr (only when DEBUG=true)
21
+ */
22
+ warn: (...args: any[]) => void;
23
+ /**
24
+ * Log an info debug message to stderr (only when DEBUG=true)
25
+ */
26
+ info: (...args: any[]) => void;
27
+ /**
28
+ * Log a debug message with a custom prefix (only when DEBUG=true)
29
+ */
30
+ prefixed: (prefix: string, ...args: any[]) => void;
31
+ /**
32
+ * Check if debug mode is currently enabled
33
+ */
34
+ readonly enabled: boolean;
35
+ };
36
+ /**
37
+ * Default export for convenience
38
+ */
39
+ export default debug;
40
+ //# sourceMappingURL=debug-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-utils.d.ts","sourceRoot":"","sources":["../../src/utils/debug-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH;;GAEG;AACH,eAAO,MAAM,KAAK;IAChB;;OAEG;mBACY,GAAG,EAAE,KAAG,IAAI;IAM3B;;OAEG;qBACc,GAAG,EAAE,KAAG,IAAI;IAM7B;;OAEG;oBACa,GAAG,EAAE,KAAG,IAAI;IAM5B;;OAEG;oBACa,GAAG,EAAE,KAAG,IAAI;IAM5B;;OAEG;uBACgB,MAAM,WAAW,GAAG,EAAE,KAAG,IAAI;IAMhD;;OAEG;sBACY,OAAO;CAGvB,CAAC;AAEF;;GAEG;AACH,eAAe,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alcyone-labs/arg-parser",
3
- "version": "2.2.1",
4
- "description": "A robust, type-safe command line argument parser with plugin architecture, dependency injection, Claude Desktop compliant MCP integration, autonomous DXT builds, and zero-dependency core functionality.",
3
+ "version": "2.4.0",
4
+ "description": "A robust, type-safe command line argument parser with plugin architecture, dependency injection, Claude Desktop compliant MCP integration, autonomous DXT builds, automatic CLI to MCP support.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -52,24 +52,25 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@alcyone-labs/simple-chalk": "^1.0.1",
55
- "@alcyone-labs/simple-mcp-logger": "^1.1.0",
55
+ "@alcyone-labs/simple-mcp-logger": "^1.2.1",
56
+ "@modelcontextprotocol/sdk": "github:Alcyone-Labs/mcp-typescript-sdk#dist",
57
+ "get-tsconfig": "^4.10.1",
56
58
  "magic-regexp": "^0.10.0",
57
- "zod": "^3.25.76"
59
+ "zod": "^4.0.10"
58
60
  },
59
61
  "optionalDependencies": {
60
- "@modelcontextprotocol/sdk": "^1.15.1",
61
62
  "dotenv": "^16.6.1",
62
63
  "express": "^5.1.0",
63
64
  "js-yaml": "^4.1.0",
64
65
  "smol-toml": "^1.4.1",
65
- "tsdown": "^0.12.9"
66
+ "tsdown": "^0.13.0"
66
67
  },
67
68
  "devDependencies": {
68
69
  "@ianvs/prettier-plugin-sort-imports": "^4.5.1",
69
70
  "@types/adm-zip": "^0.5.7",
70
71
  "@types/express": "^5.0.3",
71
72
  "@types/js-yaml": "^4.0.9",
72
- "@types/node": "^22.16.3",
73
+ "@types/node": "^22.16.5",
73
74
  "cross-env": "^7.0.3",
74
75
  "madge": "^8.0.0",
75
76
  "prettier": "^3.6.2",
@@ -86,7 +87,7 @@
86
87
  "build:esm": "cross-env VITE_BUILD_FORMAT=es VITE_MINIFY_BUILD=false vite build",
87
88
  "build:min": "cross-env VITE_BUILD_FORMAT=es VITE_MINIFY_BUILD=true vite build",
88
89
  "build": "pnpm clean && pnpm run build:types && pnpm run build:cjs && pnpm run build:esm && pnpm run build:min && pnpm run build:assets",
89
- "build:assets": "mkdir -p dist/assets && cp docs/MCP/icons/logo_1_small.jpg dist/assets/ && cp tsdown.dxt.config.ts dist/assets/ && cp .dxtignore.template dist/assets/",
90
+ "build:assets": "mkdir -p dist/assets && cp docs/MCP/icons/logo_1_small.jpg dist/assets/ && cp .dxtignore.template dist/assets/",
90
91
  "build:watch": "tsc --watch",
91
92
  "build:examples": "tsc --project tsconfig.examples.json",
92
93
  "test:watch": "vitest",
@@ -109,7 +110,6 @@
109
110
  "test:post-publish:mcp": "node scripts/post-publish-mcp-validation.mjs",
110
111
  "test:post-publish:all": "pnpm test:post-publish && pnpm test:post-publish:mcp",
111
112
  "validate:v2": "node scripts/validate-v2.mjs",
112
- "tsdown:dxt": "tsdown -c tsdown.dxt.config.ts",
113
113
  "dxt:validate": "npx @anthropic-ai/dxt validate",
114
114
  "dxt:info": "npx @anthropic-ai/dxt info",
115
115
  "dxt:sign": "npx @anthropic-ai/dxt sign --self-signed",
@@ -1,37 +0,0 @@
1
- /// <reference types="tsdown" />
2
-
3
- import { defineConfig } from "tsdown/config";
4
-
5
- export default defineConfig({
6
- outDir: "dxt",
7
- format: ["esm", "module"],
8
- target: "node22",
9
- // unbundle: true,
10
- noExternal: () => true,
11
- minify: false,
12
- sourcemap: false,
13
- clean: false,
14
- alias: {
15
- chalk: "@alcyone-labs/simple-chalk",
16
- },
17
- external: [
18
- // Node.js built-ins only - everything else should be bundled for true autonomy
19
- "stream",
20
- "fs",
21
- "path",
22
- "url",
23
- "util",
24
- "events",
25
- "child_process",
26
- "os",
27
- "tty",
28
- "process",
29
- "crypto",
30
- "http",
31
- "https",
32
- "net",
33
- "zlib",
34
- ],
35
- platform: "node",
36
- plugins: [],
37
- });