@alcyone-labs/arg-parser 2.12.1 → 2.12.3

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,13 +1,14 @@
1
1
  import * as E from "node:fs";
2
2
  import * as b from "node:path";
3
3
  import { fileURLToPath as Ct } from "node:url";
4
+ import Pt from "dotenv";
4
5
  import { createRegExp as Xe, anyOf as Ke, oneOrMore as Qe, char as et } from "magic-regexp";
5
6
  import { createMcpLogger as ne } from "@alcyone-labs/simple-mcp-logger";
6
- import { Logger as cn, createCliLogger as un, createMcpLogger as fn, logger as dn } from "@alcyone-labs/simple-mcp-logger";
7
- import { getTsconfig as Pt, createPathsMatcher as Mt } from "get-tsconfig";
8
- import { z as S } from "zod";
9
- const Tt = "\x1B[0m", Dt = "\x1B[1m", Ot = "\x1B[2m", _t = "\x1B[4m", At = "\x1B[2J\x1B[3J\x1B[H", Ft = "\x1B[30m", Nt = "\x1B[31m", jt = "\x1B[32m", kt = "\x1B[33m", It = "\x1B[34m", Rt = "\x1B[35m", tt = "\x1B[36m", Lt = "\x1B[37m", rt = "\x1B[90m";
10
- function Wt() {
7
+ import { Logger as fn, createCliLogger as dn, createMcpLogger as pn, logger as hn } from "@alcyone-labs/simple-mcp-logger";
8
+ import { getTsconfig as Mt, createPathsMatcher as Tt } from "get-tsconfig";
9
+ import { z as v } from "zod";
10
+ const Dt = "\x1B[0m", Ot = "\x1B[1m", _t = "\x1B[2m", At = "\x1B[4m", Ft = "\x1B[2J\x1B[3J\x1B[H", Nt = "\x1B[30m", jt = "\x1B[31m", kt = "\x1B[32m", It = "\x1B[33m", Rt = "\x1B[34m", Lt = "\x1B[35m", tt = "\x1B[36m", Wt = "\x1B[37m", rt = "\x1B[90m";
11
+ function Ht() {
11
12
  if (typeof globalThis.window < "u" && typeof globalThis.document < "u")
12
13
  return !globalThis.NO_COLOR;
13
14
  if (typeof process < "u") {
@@ -18,9 +19,9 @@ function Wt() {
18
19
  }
19
20
  return !1;
20
21
  }
21
- const mt = Wt();
22
- function Ht(i, ...e) {
23
- return !mt || e.length === 0 ? i : e.join("") + i + Tt;
22
+ const mt = Ht();
23
+ function Bt(i, ...e) {
24
+ return !mt || e.length === 0 ? i : e.join("") + i + Dt;
24
25
  }
25
26
  function Z(i, e, t, r) {
26
27
  Object.defineProperty(i, e, {
@@ -29,14 +30,14 @@ function Z(i, e, t, r) {
29
30
  });
30
31
  }
31
32
  function gt(i) {
32
- const e = ((t) => Ht(t, ...i));
33
- return Z(e, "bold", Dt, i), Z(e, "dim", Ot, i), Z(e, "underline", _t, i), Z(e, "black", Ft, i), Z(e, "red", Nt, i), Z(e, "green", jt, i), Z(e, "yellow", kt, i), Z(e, "blue", It, i), Z(e, "magenta", Rt, i), Z(e, "cyan", tt, i), Z(e, "white", Lt, i), Z(e, "gray", rt, i), Z(e, "grey", rt, i), Z(e, "blueBright", tt, i), Object.defineProperty(e, "clear", {
34
- get: () => mt ? At : "",
33
+ const e = ((t) => Bt(t, ...i));
34
+ return Z(e, "bold", Ot, i), Z(e, "dim", _t, i), Z(e, "underline", At, i), Z(e, "black", Nt, i), Z(e, "red", jt, i), Z(e, "green", kt, i), Z(e, "yellow", It, i), Z(e, "blue", Rt, i), Z(e, "magenta", Lt, i), Z(e, "cyan", tt, i), Z(e, "white", Wt, i), Z(e, "gray", rt, i), Z(e, "grey", rt, i), Z(e, "blueBright", tt, i), Object.defineProperty(e, "clear", {
35
+ get: () => mt ? Ft : "",
35
36
  configurable: !0
36
37
  }), e;
37
38
  }
38
- const g = gt([]), Bt = "\x1B[0m", le = "\x1B[1m", Ut = "\x1B[2m", $e = "\x1B[4m", zt = "\x1B[2J\x1B[3J\x1B[H", Gt = "\x1B[30m", Ee = "\x1B[31m", Ce = "\x1B[32m", ke = "\x1B[33m", Pe = "\x1B[34m", Vt = "\x1B[35m", nt = "\x1B[36m", Jt = "\x1B[37m", ot = "\x1B[90m";
39
- function qt() {
39
+ const g = gt([]), Ut = "\x1B[0m", le = "\x1B[1m", zt = "\x1B[2m", $e = "\x1B[4m", Gt = "\x1B[2J\x1B[3J\x1B[H", Vt = "\x1B[30m", Ee = "\x1B[31m", Ce = "\x1B[32m", ke = "\x1B[33m", Pe = "\x1B[34m", Jt = "\x1B[35m", nt = "\x1B[36m", qt = "\x1B[37m", ot = "\x1B[90m";
40
+ function Zt() {
40
41
  if (typeof globalThis.window < "u" && typeof globalThis.document < "u")
41
42
  return !globalThis.NO_COLOR;
42
43
  if (typeof process < "u") {
@@ -47,16 +48,16 @@ function qt() {
47
48
  }
48
49
  return !1;
49
50
  }
50
- const yt = qt(), W = (i) => yt ? (e) => i + e + Bt : (e) => e, Zt = {
51
+ const yt = Zt(), W = (i) => yt ? (e) => i + e + Ut : (e) => e, Yt = {
51
52
  // Colors
52
- black: W(Gt),
53
+ black: W(Vt),
53
54
  red: W(Ee),
54
55
  green: W(Ce),
55
56
  yellow: W(ke),
56
57
  blue: W(Pe),
57
- magenta: W(Vt),
58
+ magenta: W(Jt),
58
59
  cyan: W(nt),
59
- white: W(Jt),
60
+ white: W(qt),
60
61
  gray: W(ot),
61
62
  grey: W(ot),
62
63
  // alias
@@ -64,7 +65,7 @@ const yt = qt(), W = (i) => yt ? (e) => i + e + Bt : (e) => e, Zt = {
64
65
  // alias
65
66
  // Modifiers
66
67
  bold: W(le),
67
- dim: W(Ut),
68
+ dim: W(zt),
68
69
  underline: W($e),
69
70
  /**
70
71
  * [NON-CHALK EXTENSION] Returns an ANSI escape sequence that clears the screen
@@ -75,7 +76,7 @@ const yt = qt(), W = (i) => yt ? (e) => i + e + Bt : (e) => e, Zt = {
75
76
  * process.stdout.write(fast.clear);
76
77
  * ```
77
78
  */
78
- clear: yt ? zt : "",
79
+ clear: yt ? Gt : "",
79
80
  // Pre-created common combinations for some chaining support
80
81
  redBold: W(Ee + le),
81
82
  greenBold: W(Ce + le),
@@ -89,7 +90,7 @@ const yt = qt(), W = (i) => yt ? (e) => i + e + Bt : (e) => e, Zt = {
89
90
  boldBlue: W(le + Pe),
90
91
  boldYellow: W(le + ke)
91
92
  };
92
- Object.assign((i) => i, Zt);
93
+ Object.assign((i) => i, Yt);
93
94
  const me = typeof globalThis.window < "u" && typeof globalThis.document < "u", pe = {
94
95
  reset: "",
95
96
  bold: "font-weight: bold;",
@@ -142,7 +143,7 @@ function Te(i, e) {
142
143
  function Y(i) {
143
144
  return (e) => me ? Me([pe[i]], e) : Te([ue[i]], e);
144
145
  }
145
- const Yt = {
146
+ const Xt = {
146
147
  // Colors
147
148
  black: Y("black"),
148
149
  red: Y("red"),
@@ -179,7 +180,7 @@ const Yt = {
179
180
  greenBold: (i) => me ? Me([pe.green, pe.bold], i) : Te([ue.green, ue.bold], i),
180
181
  blueBold: (i) => me ? Me([pe.blue, pe.bold], i) : Te([ue.blue, ue.bold], i)
181
182
  };
182
- Object.assign((i) => i, Yt);
183
+ Object.assign((i) => i, Xt);
183
184
  class Ae {
184
185
  /**
185
186
  * Check if this plugin supports a given file extension
@@ -188,7 +189,7 @@ class Ae {
188
189
  return this.supportedExtensions.includes(e.toLowerCase());
189
190
  }
190
191
  }
191
- class Xt extends Ae {
192
+ class Kt extends Ae {
192
193
  constructor() {
193
194
  super(...arguments), this.supportedExtensions = [".json", ".jsonc"], this.name = "json";
194
195
  }
@@ -222,7 +223,7 @@ class Xt extends Ae {
222
223
  return JSON.stringify(s, null, 2);
223
224
  }
224
225
  }
225
- class Kt extends Ae {
226
+ class Qt extends Ae {
226
227
  constructor() {
227
228
  super(...arguments), this.supportedExtensions = [".env"], this.name = "env";
228
229
  }
@@ -264,9 +265,9 @@ class Kt extends Ae {
264
265
  return typeof e == "function" ? e.name || "custom function" : String(e).toLowerCase();
265
266
  }
266
267
  }
267
- class Qt {
268
+ class er {
268
269
  constructor() {
269
- this.plugins = /* @__PURE__ */ new Map(), this.extensionMap = /* @__PURE__ */ new Map(), this.registerPlugin(new Xt()), this.registerPlugin(new Kt());
270
+ this.plugins = /* @__PURE__ */ new Map(), this.extensionMap = /* @__PURE__ */ new Map(), this.registerPlugin(new Kt()), this.registerPlugin(new Qt());
270
271
  }
271
272
  /**
272
273
  * Register a configuration plugin
@@ -346,25 +347,25 @@ class Qt {
346
347
  */
347
348
  async autoRegisterOptionalPluginsAsync() {
348
349
  try {
349
- const { createTomlPluginAsync: e } = await Promise.resolve().then(() => gr), t = await e();
350
+ const { createTomlPluginAsync: e } = await Promise.resolve().then(() => yr), t = await e();
350
351
  t && this.registerPlugin(t);
351
352
  } catch {
352
353
  }
353
354
  try {
354
- const { createYamlPluginAsync: e } = await Promise.resolve().then(() => wr), t = await e();
355
+ const { createYamlPluginAsync: e } = await Promise.resolve().then(() => vr), t = await e();
355
356
  t && this.registerPlugin(t);
356
357
  } catch {
357
358
  }
358
359
  }
359
360
  }
360
- const ie = new Qt();
361
- function Jr() {
361
+ const ie = new er();
362
+ function Zr() {
362
363
  ie.autoRegisterOptionalPlugins();
363
364
  }
364
- async function qr() {
365
+ async function Yr() {
365
366
  await ie.autoRegisterOptionalPluginsAsync();
366
367
  }
367
- function Zr(i) {
368
+ function Xr(i) {
368
369
  for (const e of i)
369
370
  switch (e.toLowerCase()) {
370
371
  case "toml":
@@ -391,7 +392,7 @@ function Zr(i) {
391
392
  console.warn(`Unknown config plugin: ${e}`);
392
393
  }
393
394
  }
394
- class er {
395
+ class tr {
395
396
  constructor(e) {
396
397
  this.argParserInstance = e;
397
398
  }
@@ -735,8 +736,8 @@ class er {
735
736
  for (const [a, l] of Object.entries(e)) {
736
737
  const c = s(a), f = c.replace(/^--?/, "");
737
738
  if (!n.some((u) => {
738
- const v = u.replace(/^--?/, "").split("=")[0];
739
- return v === f || v === a;
739
+ const w = u.replace(/^--?/, "").split("=")[0];
740
+ return w === f || w === a;
740
741
  }))
741
742
  if (typeof l == "boolean")
742
743
  l && n.push(c);
@@ -835,7 +836,7 @@ function Le() {
835
836
  return null;
836
837
  }
837
838
  }
838
- function Yr(i) {
839
+ function Kr(i) {
839
840
  return i.startsWith("file://") ? decodeURIComponent(i.replace("file://", "")) : i;
840
841
  }
841
842
  function st(i) {
@@ -884,26 +885,26 @@ function ce(i, e) {
884
885
  ), b.resolve(process.cwd(), s));
885
886
  }
886
887
  }
887
- function Xr(i) {
888
+ function Qr(i) {
888
889
  return {
889
890
  path: i,
890
891
  relativeTo: "entry"
891
892
  };
892
893
  }
893
- function Kr(i) {
894
+ function en(i) {
894
895
  return {
895
896
  path: i,
896
897
  relativeTo: "cwd"
897
898
  };
898
899
  }
899
- function Qr(i, e) {
900
+ function tn(i, e) {
900
901
  return {
901
902
  path: i,
902
903
  relativeTo: "absolute",
903
904
  basePath: e
904
905
  };
905
906
  }
906
- function en(i) {
907
+ function rn(i) {
907
908
  return `cwd:${i}`;
908
909
  }
909
910
  const Ye = class Ye {
@@ -1126,67 +1127,67 @@ const Ie = {
1126
1127
  * even in bottom-up construction scenarios.
1127
1128
  */
1128
1129
  AllParents: "all-parents"
1129
- }, tr = S.object({
1130
- sensitive: S.boolean().optional().describe(
1130
+ }, rr = v.object({
1131
+ sensitive: v.boolean().optional().describe(
1131
1132
  "Whether this field should be marked as sensitive in DXT user_config"
1132
1133
  ),
1133
- localDefault: S.string().optional().describe("Default value specific to DXT sandbox environment"),
1134
- type: S.enum(["string", "directory", "file", "boolean", "number"]).optional().describe("DXT input type - determines UI component in DXT clients"),
1135
- multiple: S.boolean().optional().describe("Allow multiple values (for arrays)"),
1136
- min: S.number().optional().describe("Minimum value (for number type)"),
1137
- max: S.number().optional().describe("Maximum value (for number type)"),
1138
- default: S.any().optional().describe(
1134
+ localDefault: v.string().optional().describe("Default value specific to DXT sandbox environment"),
1135
+ type: v.enum(["string", "directory", "file", "boolean", "number"]).optional().describe("DXT input type - determines UI component in DXT clients"),
1136
+ multiple: v.boolean().optional().describe("Allow multiple values (for arrays)"),
1137
+ min: v.number().optional().describe("Minimum value (for number type)"),
1138
+ max: v.number().optional().describe("Maximum value (for number type)"),
1139
+ default: v.any().optional().describe(
1139
1140
  "DXT-specific default value (overrides localDefault if provided)"
1140
1141
  ),
1141
- title: S.string().optional().describe("Custom title for the user_config field")
1142
+ title: v.string().optional().describe("Custom title for the user_config field")
1142
1143
  }).strict().refine(
1143
1144
  (i) => !((i.min !== void 0 || i.max !== void 0) && i.type !== "number" || i.min !== void 0 && i.max !== void 0 && i.min > i.max),
1144
1145
  {
1145
1146
  message: "Invalid dxtOptions: min/max can only be used with type 'number', and min must be <= max"
1146
1147
  }
1147
- ), rr = S.object({
1148
- name: S.string().min(1, "Flag name cannot be empty").describe(
1148
+ ), nr = v.object({
1149
+ name: v.string().min(1, "Flag name cannot be empty").describe(
1149
1150
  "The output property name, used as a return key `{name: value}`. Must be unique."
1150
1151
  ),
1151
- allowLigature: S.boolean().default(!0).describe(
1152
+ allowLigature: v.boolean().default(!0).describe(
1152
1153
  "Enable both forms of flag input, e.g., `./script.js -f=value` and `-f value`."
1153
1154
  ),
1154
- allowMultiple: S.boolean().default(!1).describe(
1155
+ allowMultiple: v.boolean().default(!1).describe(
1155
1156
  "Allow passing the same flag multiple times, e.g., `-f val1 -f val2` results in an array."
1156
1157
  ),
1157
- description: S.union([S.string(), S.array(S.string())]).optional().describe("Textual description for help messages."),
1158
- valueHint: S.string().optional().describe("Hint/example value shown in help and examples."),
1159
- options: S.array(S.string().min(1)).min(1, "Flag must have at least one option (e.g., ['-f', '--flag'])").describe("Array of option strings, e.g., ['-f', '--flag']."),
1160
- defaultValue: S.any().optional().describe("Default value if the flag is not provided."),
1161
- type: S.union([
1162
- S.any().refine((i) => i === String, {
1158
+ description: v.union([v.string(), v.array(v.string())]).optional().describe("Textual description for help messages."),
1159
+ valueHint: v.string().optional().describe("Hint/example value shown in help and examples."),
1160
+ options: v.array(v.string().min(1)).min(1, "Flag must have at least one option (e.g., ['-f', '--flag'])").describe("Array of option strings, e.g., ['-f', '--flag']."),
1161
+ defaultValue: v.any().optional().describe("Default value if the flag is not provided."),
1162
+ type: v.union([
1163
+ v.any().refine((i) => i === String, {
1163
1164
  message: "Must be String constructor"
1164
1165
  }),
1165
- S.any().refine((i) => i === Number, {
1166
+ v.any().refine((i) => i === Number, {
1166
1167
  message: "Must be Number constructor"
1167
1168
  }),
1168
- S.any().refine((i) => i === Boolean, {
1169
+ v.any().refine((i) => i === Boolean, {
1169
1170
  message: "Must be Boolean constructor"
1170
1171
  }),
1171
- S.any().refine((i) => i === Array, {
1172
+ v.any().refine((i) => i === Array, {
1172
1173
  // Native Array constructor
1173
1174
  message: "Must be Array constructor"
1174
1175
  }),
1175
- S.any().refine((i) => i === Object, {
1176
+ v.any().refine((i) => i === Object, {
1176
1177
  // Native Object constructor
1177
1178
  message: "Must be Object constructor"
1178
1179
  }),
1179
- S.custom(
1180
+ v.custom(
1180
1181
  (i) => typeof i == "function",
1181
1182
  "Must be a custom parser function"
1182
1183
  ),
1183
1184
  // Custom parser function (value: string) => any | Promise<any>
1184
- S.custom(
1185
+ v.custom(
1185
1186
  (i) => i && typeof i == "object" && i._def,
1186
1187
  "Must be a Zod schema"
1187
1188
  ),
1188
1189
  // Zod schema for structured JSON validation
1189
- S.string().refine(
1190
+ v.string().refine(
1190
1191
  // String literal types
1191
1192
  (i) => ["boolean", "string", "number", "array", "object"].includes(
1192
1193
  i.toLowerCase()
@@ -1198,32 +1199,32 @@ const Ie = {
1198
1199
  ]).default("string").describe(
1199
1200
  "Expected data type (constructor, string literal, custom parser function, or Zod schema). Defaults to 'string'."
1200
1201
  ),
1201
- mandatory: S.union([
1202
- S.boolean(),
1203
- S.custom(
1202
+ mandatory: v.union([
1203
+ v.boolean(),
1204
+ v.custom(
1204
1205
  (i) => typeof i == "function",
1205
1206
  "Must be a boolean or function"
1206
1207
  )
1207
1208
  ]).optional().describe(
1208
1209
  "Makes the flag mandatory, can be a boolean or a function conditional on other args."
1209
1210
  ),
1210
- flagOnly: S.boolean().default(!1).describe(
1211
+ flagOnly: v.boolean().default(!1).describe(
1211
1212
  "If true, the flag's presence is noted (true/false), and any subsequent value is not consumed by this flag."
1212
1213
  ),
1213
- validate: S.custom((i) => typeof i == "function", "Must be a validation function").optional().describe(
1214
+ validate: v.custom((i) => typeof i == "function", "Must be a validation function").optional().describe(
1214
1215
  "Custom validation function for the flag's value (receives value, parsedArgs)."
1215
1216
  ),
1216
- enum: S.array(S.any()).optional().describe("Array of allowed values for the flag."),
1217
- env: S.union([S.string(), S.array(S.string())]).optional().describe(
1217
+ enum: v.array(v.any()).optional().describe("Array of allowed values for the flag."),
1218
+ env: v.union([v.string(), v.array(v.string())]).optional().describe(
1218
1219
  "Environment variable(s) to map to this flag. Logic: Fallback (Env -> Flag) and Sync (Flag -> Env). Precedence: Flag > Env > Default."
1219
1220
  ),
1220
- dxtOptions: tr.optional().describe(
1221
+ dxtOptions: rr.optional().describe(
1221
1222
  "DXT-specific configuration options for enhanced DXT manifest generation"
1222
1223
  ),
1223
- dynamicRegister: S.custom((i) => typeof i == "function").optional().describe(
1224
+ dynamicRegister: v.custom((i) => typeof i == "function").optional().describe(
1224
1225
  "Optional callback that can register additional flags dynamically when this flag is present."
1225
1226
  ),
1226
- setWorkingDirectory: S.boolean().optional().describe(
1227
+ setWorkingDirectory: v.boolean().optional().describe(
1227
1228
  "If true, this flag's value becomes the effective working directory for file operations."
1228
1229
  )
1229
1230
  }).transform((i) => {
@@ -1257,55 +1258,55 @@ const Re = {
1257
1258
  * Simple success/error response pattern
1258
1259
  * @example { success: true, message: "Operation completed" }
1259
1260
  */
1260
- successError: () => S.object({
1261
- success: S.boolean().describe("Whether the operation was successful"),
1262
- message: S.string().optional().describe("Optional message about the operation"),
1263
- error: S.string().optional().describe("Error message if operation failed")
1261
+ successError: () => v.object({
1262
+ success: v.boolean().describe("Whether the operation was successful"),
1263
+ message: v.string().optional().describe("Optional message about the operation"),
1264
+ error: v.string().optional().describe("Error message if operation failed")
1264
1265
  }),
1265
1266
  /**
1266
1267
  * Success response with data payload
1267
1268
  * @example { success: true, data: {...}, message: "Data retrieved" }
1268
1269
  */
1269
- successWithData: (i) => S.object({
1270
- success: S.boolean().describe("Whether the operation was successful"),
1271
- data: i || S.any().describe("The response data"),
1272
- message: S.string().optional().describe("Optional message about the operation"),
1273
- error: S.string().optional().describe("Error message if operation failed")
1270
+ successWithData: (i) => v.object({
1271
+ success: v.boolean().describe("Whether the operation was successful"),
1272
+ data: i || v.any().describe("The response data"),
1273
+ message: v.string().optional().describe("Optional message about the operation"),
1274
+ error: v.string().optional().describe("Error message if operation failed")
1274
1275
  }),
1275
1276
  /**
1276
1277
  * List/array response pattern
1277
1278
  * @example { items: [...], count: 5, hasMore: false }
1278
1279
  */
1279
- list: (i) => S.object({
1280
- items: S.array(i || S.any()).describe("Array of items"),
1281
- count: S.number().optional().describe("Total number of items"),
1282
- hasMore: S.boolean().optional().describe("Whether there are more items available")
1280
+ list: (i) => v.object({
1281
+ items: v.array(i || v.any()).describe("Array of items"),
1282
+ count: v.number().optional().describe("Total number of items"),
1283
+ hasMore: v.boolean().optional().describe("Whether there are more items available")
1283
1284
  }),
1284
1285
  /**
1285
1286
  * File operation response pattern
1286
1287
  * @example { path: "/path/to/file", size: 1024, created: true }
1287
1288
  */
1288
- fileOperation: () => S.object({
1289
- path: S.string().describe("File path"),
1290
- size: S.number().optional().describe("File size in bytes"),
1291
- created: S.boolean().optional().describe("Whether the file was created"),
1292
- modified: S.boolean().optional().describe("Whether the file was modified"),
1293
- exists: S.boolean().optional().describe("Whether the file exists")
1289
+ fileOperation: () => v.object({
1290
+ path: v.string().describe("File path"),
1291
+ size: v.number().optional().describe("File size in bytes"),
1292
+ created: v.boolean().optional().describe("Whether the file was created"),
1293
+ modified: v.boolean().optional().describe("Whether the file was modified"),
1294
+ exists: v.boolean().optional().describe("Whether the file exists")
1294
1295
  }),
1295
1296
  /**
1296
1297
  * Process execution response pattern
1297
1298
  * @example { exitCode: 0, stdout: "output", stderr: "", duration: 1500 }
1298
1299
  */
1299
- processExecution: () => S.object({
1300
- exitCode: S.number().describe("Process exit code"),
1301
- stdout: S.string().optional().describe("Standard output"),
1302
- stderr: S.string().optional().describe("Standard error output"),
1303
- duration: S.number().optional().describe("Execution duration in milliseconds"),
1304
- command: S.string().optional().describe("The command that was executed")
1300
+ processExecution: () => v.object({
1301
+ exitCode: v.number().describe("Process exit code"),
1302
+ stdout: v.string().optional().describe("Standard output"),
1303
+ stderr: v.string().optional().describe("Standard error output"),
1304
+ duration: v.number().optional().describe("Execution duration in milliseconds"),
1305
+ command: v.string().optional().describe("The command that was executed")
1305
1306
  })
1306
1307
  };
1307
1308
  function fe(i) {
1308
- return typeof i == "string" && i in Re ? Re[i]() : i && typeof i == "object" && "_def" in i ? i : i && typeof i == "object" ? S.object(i) : Re.successError();
1309
+ return typeof i == "string" && i in Re ? Re[i]() : i && typeof i == "object" && "_def" in i ? i : i && typeof i == "object" ? v.object(i) : Re.successError();
1309
1310
  }
1310
1311
  class it {
1311
1312
  constructor(e, t, r) {
@@ -1389,7 +1390,7 @@ echo "Mock DXT build script for ${o.name}"`;
1389
1390
  return process.env.NODE_ENV === "test" || process.argv[0]?.includes("vitest") || process.argv[1]?.includes("vitest") || process.argv[1]?.includes("tinypool");
1390
1391
  }
1391
1392
  }
1392
- class nr {
1393
+ class or {
1393
1394
  constructor(e) {
1394
1395
  this.argParserInstance = e;
1395
1396
  }
@@ -1704,7 +1705,7 @@ class nr {
1704
1705
  `${r ? "with node_modules" : "without node_modules"}`
1705
1706
  )
1706
1707
  );
1707
- const u = this.argParserInstance.getMcpServerConfig?.(), v = b.dirname(s), x = v !== "." && v !== "" ? b.resolve(f, t, v) : b.resolve(f, t), p = {
1708
+ const u = this.argParserInstance.getMcpServerConfig?.(), w = b.dirname(s), x = w !== "." && w !== "" ? b.resolve(f, t, w) : b.resolve(f, t), p = {
1708
1709
  entry: [s],
1709
1710
  outDir: x,
1710
1711
  format: ["es"],
@@ -1722,35 +1723,35 @@ class nr {
1722
1723
  unbundle: !0,
1723
1724
  external: (m, h) => {
1724
1725
  try {
1725
- const w = this.shouldModuleBeExternal(
1726
+ const S = this.shouldModuleBeExternal(
1726
1727
  m,
1727
1728
  h,
1728
1729
  r
1729
1730
  );
1730
1731
  return process.env.DEBUG && console.log(
1731
- `[${g.blue("External")}] ${g.yellow(w ? "true" : "false")} for module: (${g.green(m)}), path: '${g.grey(h ?? "")}'`
1732
- ), !!w;
1733
- } catch (w) {
1732
+ `[${g.blue("External")}] ${g.yellow(S ? "true" : "false")} for module: (${g.green(m)}), path: '${g.grey(h ?? "")}'`
1733
+ ), !!S;
1734
+ } catch (S) {
1734
1735
  return console.warn(
1735
1736
  `Warning: Error in external function for ${m}:`,
1736
- w
1737
+ S
1737
1738
  ), !0;
1738
1739
  }
1739
1740
  },
1740
1741
  noExternal: (m, h) => {
1741
1742
  try {
1742
- const w = this.shouldModuleBeExternal(
1743
+ const S = this.shouldModuleBeExternal(
1743
1744
  m,
1744
1745
  h,
1745
1746
  r
1746
1747
  );
1747
1748
  return process.env.DEBUG && console.log(
1748
- `[${g.yellow("noExternal")}] ${g.yellow(w === !1 ? "true" : "false")} for module: (${g.green(m)}), path: '${g.grey(h ?? "")}'`
1749
- ), w === !1;
1750
- } catch (w) {
1749
+ `[${g.yellow("noExternal")}] ${g.yellow(S === !1 ? "true" : "false")} for module: (${g.green(m)}), path: '${g.grey(h ?? "")}'`
1750
+ ), S === !1;
1751
+ } catch (S) {
1751
1752
  return console.warn(
1752
1753
  `Warning: Error in noExternal function for ${m}:`,
1753
- w
1754
+ S
1754
1755
  ), !1;
1755
1756
  }
1756
1757
  },
@@ -1762,12 +1763,12 @@ class nr {
1762
1763
  "📦 Including node_modules in bundle (may take longer)..."
1763
1764
  )
1764
1765
  ), h.push("node_modules"));
1765
- const w = v !== "." && v !== "" ? b.dirname(m.outDir) : m.outDir;
1766
+ const S = w !== "." && w !== "" ? b.dirname(m.outDir) : m.outDir;
1766
1767
  if (c) {
1767
1768
  const y = typeof process < "u" ? process.cwd() : "/test", C = b.join(y, c);
1768
1769
  E.existsSync(C) && (console.log(g.gray(`Adding logo from: ${C}`)), h.push({
1769
1770
  from: C,
1770
- to: b.join(w, c)
1771
+ to: b.join(S, c)
1771
1772
  }));
1772
1773
  }
1773
1774
  if (u?.dxt?.include) {
@@ -1789,7 +1790,7 @@ class nr {
1789
1790
  );
1790
1791
  E.existsSync(M) ? (console.log(g.gray(` • ${C}`)), h.push({
1791
1792
  from: M,
1792
- to: b.join(w, C)
1793
+ to: b.join(S, C)
1793
1794
  })) : console.warn(
1794
1795
  g.yellow(
1795
1796
  ` ⚠ File not found: ${C} (resolved to ${M})`
@@ -1814,7 +1815,7 @@ class nr {
1814
1815
  )
1815
1816
  ), h.push({
1816
1817
  from: P,
1817
- to: b.join(w, M)
1818
+ to: b.join(S, M)
1818
1819
  })) : console.warn(
1819
1820
  g.yellow(
1820
1821
  ` ⚠ File not found: ${C} (resolved to ${P})`
@@ -2087,12 +2088,12 @@ export default ${JSON.stringify(p, null, 2)};
2087
2088
  ];
2088
2089
  }
2089
2090
  const { envVars: f, userConfig: d } = this.generateEnvAndUserConfig(), u = this.extractMcpServerInfo();
2090
- let v;
2091
+ let w;
2091
2092
  if (r)
2092
- v = r;
2093
+ w = r;
2093
2094
  else {
2094
2095
  const p = this.findProjectRoot(e), $ = b.resolve(e);
2095
- v = b.relative(p, $).replace(/\.ts$/, ".js");
2096
+ w = b.relative(p, $).replace(/\.ts$/, ".js");
2096
2097
  }
2097
2098
  const x = {
2098
2099
  dxt_version: "0.1",
@@ -2106,11 +2107,11 @@ export default ${JSON.stringify(p, null, 2)};
2106
2107
  },
2107
2108
  server: {
2108
2109
  type: "node",
2109
- entry_point: v,
2110
+ entry_point: w,
2110
2111
  mcp_config: {
2111
2112
  command: "node",
2112
2113
  args: [
2113
- `\${__dirname}/${v}`,
2114
+ `\${__dirname}/${w}`,
2114
2115
  "--s-mcp-serve",
2115
2116
  // Overwrite the CLI config to only use stdio to avoid conflicts
2116
2117
  "--s-mcp-transport",
@@ -2139,8 +2140,8 @@ export default ${JSON.stringify(p, null, 2)};
2139
2140
  detectTsdownOutputFile(e, t) {
2140
2141
  try {
2141
2142
  let r = function(d, u = "") {
2142
- const v = E.readdirSync(d, { withFileTypes: !0 });
2143
- for (const x of v) {
2143
+ const w = E.readdirSync(d, { withFileTypes: !0 });
2144
+ for (const x of w) {
2144
2145
  const p = b.join(d, x.name), $ = b.join(u, x.name);
2145
2146
  if (x.isDirectory()) {
2146
2147
  if (x.name === "node_modules" || x.name.startsWith("."))
@@ -2174,9 +2175,9 @@ export default ${JSON.stringify(p, null, 2)};
2174
2175
  return console.log(g.gray(`✓ Detected TSDown output: ${f[0]}`)), f[0];
2175
2176
  if (f.length > 1) {
2176
2177
  let d = f[0], u = 0;
2177
- for (const v of f) {
2178
- const x = b.join(o, v), p = E.statSync(x), $ = v.includes(c) ? 100 : 0, m = Math.min(p.size / 1e3, 50), h = $ + m;
2179
- h > u && (u = h, d = v);
2178
+ for (const w of f) {
2179
+ const x = b.join(o, w), p = E.statSync(x), $ = w.includes(c) ? 100 : 0, m = Math.min(p.size / 1e3, 50), h = $ + m;
2180
+ h > u && (u = h, d = w);
2180
2181
  }
2181
2182
  return console.log(
2182
2183
  g.gray(
@@ -2297,19 +2298,19 @@ export default ${JSON.stringify(p, null, 2)};
2297
2298
  for (const [, f] of c) {
2298
2299
  const d = f.flags || [];
2299
2300
  for (const u of d) {
2300
- const v = u.env || u.envVar;
2301
- if (v && !e[v]) {
2302
- this.validateDxtOptions(u, v), e[v] = `\${user_config.${v}}`;
2301
+ const w = u.env || u.envVar;
2302
+ if (w && !e[w]) {
2303
+ this.validateDxtOptions(u, w), e[w] = `\${user_config.${w}}`;
2303
2304
  const x = {
2304
2305
  type: o(u),
2305
- title: s(u, v),
2306
- description: a(u, v),
2306
+ title: s(u, w),
2307
+ description: a(u, w),
2307
2308
  required: r(u),
2308
2309
  // Respect the flag's mandatory setting
2309
2310
  sensitive: n(u)
2310
2311
  // Use dxtOptions or default logic
2311
2312
  };
2312
- u.dxtOptions?.multiple !== void 0 && (x.multiple = u.dxtOptions.multiple), u.dxtOptions?.min !== void 0 && (x.min = u.dxtOptions.min), u.dxtOptions?.max !== void 0 && (x.max = u.dxtOptions.max), u.dxtOptions?.default !== void 0 && typeof u.dxtOptions.default != "function" ? x.default = u.dxtOptions.default : u.dxtOptions?.localDefault !== void 0 && typeof u.dxtOptions.localDefault != "function" && (x.default = u.dxtOptions.localDefault), t[v] = x;
2313
+ u.dxtOptions?.multiple !== void 0 && (x.multiple = u.dxtOptions.multiple), u.dxtOptions?.min !== void 0 && (x.min = u.dxtOptions.min), u.dxtOptions?.max !== void 0 && (x.max = u.dxtOptions.max), u.dxtOptions?.default !== void 0 && typeof u.dxtOptions.default != "function" ? x.default = u.dxtOptions.default : u.dxtOptions?.localDefault !== void 0 && typeof u.dxtOptions.localDefault != "function" && (x.default = u.dxtOptions.localDefault), t[w] = x;
2313
2314
  }
2314
2315
  }
2315
2316
  }
@@ -2321,7 +2322,7 @@ export default ${JSON.stringify(p, null, 2)};
2321
2322
  process.env.DEBUG && console.log(
2322
2323
  ` <${g.gray("module-resolve")}> Resolving '${g.green(e)}' from '${g.gray(t)}'`
2323
2324
  );
2324
- const r = Pt(t);
2325
+ const r = Mt(t);
2325
2326
  if (!r?.config.compilerOptions?.paths)
2326
2327
  process.env.DEBUG && console.log(
2327
2328
  ` <${g.gray("ts-paths")}> No tsconfig or paths found for '${t}'`
@@ -2334,7 +2335,7 @@ export default ${JSON.stringify(p, null, 2)};
2334
2335
  Object.keys(r.config.compilerOptions.paths)
2335
2336
  );
2336
2337
  }
2337
- const s = Mt(r);
2338
+ const s = Tt(r);
2338
2339
  if (!s || typeof s != "function")
2339
2340
  process.env.DEBUG && console.log(
2340
2341
  ` <${g.gray("ts-paths")}> Failed to create paths matcher or matcher is not a function`
@@ -2361,11 +2362,11 @@ export default ${JSON.stringify(p, null, 2)};
2361
2362
  if (c.endsWith(".js")) {
2362
2363
  const d = c.slice(0, -3);
2363
2364
  for (const u of [".ts", ".tsx"]) {
2364
- const v = d + u;
2365
- if (E.existsSync(v) && E.statSync(v).isFile())
2365
+ const w = d + u;
2366
+ if (E.existsSync(w) && E.statSync(w).isFile())
2366
2367
  return process.env.DEBUG && console.log(
2367
- ` <${g.grey("ts-paths")}> ✓ Resolved '${e}' to '${v}' (replaced .js)`
2368
- ), v;
2368
+ ` <${g.grey("ts-paths")}> ✓ Resolved '${e}' to '${w}' (replaced .js)`
2369
+ ), w;
2369
2370
  }
2370
2371
  }
2371
2372
  for (const d of f) {
@@ -2435,7 +2436,7 @@ export default ${JSON.stringify(p, null, 2)};
2435
2436
  }
2436
2437
  }
2437
2438
  const at = ne("MCP Notifications");
2438
- class or {
2439
+ class sr {
2439
2440
  constructor() {
2440
2441
  this.clients = /* @__PURE__ */ new Map(), this.globalListeners = /* @__PURE__ */ new Set(), this.changeHistory = [], this.maxHistorySize = 100;
2441
2442
  }
@@ -2596,8 +2597,8 @@ class or {
2596
2597
  this.clients.clear(), this.globalListeners.clear(), this.changeHistory = [];
2597
2598
  }
2598
2599
  }
2599
- const sr = ne("MCP Prompts");
2600
- class ir {
2600
+ const ir = ne("MCP Prompts");
2601
+ class ar {
2601
2602
  constructor() {
2602
2603
  this.prompts = /* @__PURE__ */ new Map(), this.changeListeners = /* @__PURE__ */ new Set();
2603
2604
  }
@@ -2646,7 +2647,7 @@ class ir {
2646
2647
  const n = r.config.argsSchema.parse(t);
2647
2648
  return await r.config.handler(n);
2648
2649
  } catch (n) {
2649
- throw n instanceof S.ZodError ? new Error(
2650
+ throw n instanceof v.ZodError ? new Error(
2650
2651
  `Invalid arguments for prompt '${e}': ${n.message}`
2651
2652
  ) : n;
2652
2653
  }
@@ -2697,11 +2698,11 @@ class ir {
2697
2698
  try {
2698
2699
  e();
2699
2700
  } catch (t) {
2700
- sr.error("Error in prompt change listener:", t);
2701
+ ir.error("Error in prompt change listener:", t);
2701
2702
  }
2702
2703
  }
2703
2704
  }
2704
- const ar = ne("MCP Resources");
2705
+ const lr = ne("MCP Resources");
2705
2706
  class lt {
2706
2707
  constructor(e) {
2707
2708
  const t = e.match(/\{([^}]+)\}/g) || [];
@@ -2733,7 +2734,7 @@ class lt {
2733
2734
  return [...this.paramNames];
2734
2735
  }
2735
2736
  }
2736
- class lr {
2737
+ class cr {
2737
2738
  constructor() {
2738
2739
  this.resources = /* @__PURE__ */ new Map(), this.changeListeners = /* @__PURE__ */ new Set();
2739
2740
  }
@@ -2835,7 +2836,7 @@ class lr {
2835
2836
  try {
2836
2837
  e();
2837
2838
  } catch (t) {
2838
- ar.error("Error in resource change listener:", t);
2839
+ lr.error("Error in resource change listener:", t);
2839
2840
  }
2840
2841
  }
2841
2842
  }
@@ -2908,7 +2909,7 @@ class Ge {
2908
2909
  this.#o = e.throwForDuplicateFlags ?? !1, this.addFlags(t);
2909
2910
  }
2910
2911
  static _safeFlag(e) {
2911
- const t = rr.parse(e);
2912
+ const t = nr.parse(e);
2912
2913
  let r;
2913
2914
  const n = t.type;
2914
2915
  if (typeof n == "string")
@@ -3014,9 +3015,9 @@ class V {
3014
3015
  // Track dynamically added flags so we can clean them between parses
3015
3016
  #C = /* @__PURE__ */ new Set();
3016
3017
  // MCP-related managers
3017
- #S = new lr();
3018
- #x = new ir();
3019
- #g = new or();
3018
+ #S = new cr();
3019
+ #x = new ar();
3020
+ #g = new sr();
3020
3021
  // Working directory management
3021
3022
  /** The effective working directory for this parser instance */
3022
3023
  #l = null;
@@ -3048,7 +3049,7 @@ class V {
3048
3049
  validate: (n, o) => !0
3049
3050
  // Ensure signature matches Zod schema for .args()
3050
3051
  };
3051
- if (this.#r.addFlag(r), this.#M = new nr(this), this.#i = new er(this), e.subCommands)
3052
+ if (this.#r.addFlag(r), this.#M = new or(this), this.#i = new tr(this), e.subCommands)
3052
3053
  for (const n of e.subCommands)
3053
3054
  this.addSubCommand(n);
3054
3055
  }
@@ -3268,9 +3269,9 @@ class V {
3268
3269
  #h(e, t, r, n) {
3269
3270
  let o = -1, s = null;
3270
3271
  for (let u = 0; u < e.length; u++) {
3271
- const v = e[u];
3272
- if (t.#s.has(v)) {
3273
- o = u, s = v;
3272
+ const w = e[u];
3273
+ if (t.#s.has(w)) {
3274
+ o = u, s = w;
3274
3275
  break;
3275
3276
  }
3276
3277
  }
@@ -3329,10 +3330,10 @@ class V {
3329
3330
  }
3330
3331
  r = d, process.chdir(d);
3331
3332
  const u = [];
3332
- for (let v = 0; v < e.length; v++)
3333
+ for (let w = 0; w < e.length; w++)
3333
3334
  for (const x of t)
3334
3335
  for (const p of x.#r.flags)
3335
- p.setWorkingDirectory && p.options.includes(e[v]) && u.push({ index: v, flag: e[v] });
3336
+ p.setWorkingDirectory && p.options.includes(e[w]) && u.push({ index: w, flag: e[w] });
3336
3337
  u.length > 1 && this.#e.warn(
3337
3338
  g.yellow(
3338
3339
  `Warning: Multiple working directory flags detected. Using '${l}' (last one in command chain).`
@@ -3394,13 +3395,13 @@ class V {
3394
3395
  this,
3395
3396
  [],
3396
3397
  [this]
3397
- ), w = m.#i.loadEnvFile(
3398
+ ), S = m.#i.loadEnvFile(
3398
3399
  p,
3399
3400
  h
3400
3401
  );
3401
- if (w) {
3402
+ if (S) {
3402
3403
  const C = m.#i.mergeEnvConfigWithArgs(
3403
- w,
3404
+ S,
3404
3405
  e,
3405
3406
  h
3406
3407
  );
@@ -3433,13 +3434,13 @@ class V {
3433
3434
  this,
3434
3435
  [],
3435
3436
  [this]
3436
- ), w = m.#i.loadEnvFile(
3437
+ ), S = m.#i.loadEnvFile(
3437
3438
  p,
3438
3439
  h
3439
3440
  );
3440
- if (w) {
3441
+ if (S) {
3441
3442
  const y = m.#i.mergeEnvConfigWithArgs(
3442
- w,
3443
+ S,
3443
3444
  e,
3444
3445
  h
3445
3446
  );
@@ -3467,23 +3468,20 @@ class V {
3467
3468
  if (this.#$ && this.#l !== this.#f && !l) {
3468
3469
  const p = this.#l || process.cwd(), $ = this.#i.discoverEnvFile(p);
3469
3470
  if ($) {
3470
- console.warn(`Auto-discovered env file: ${$}`);
3471
+ console.warn(`Auto-discovered env file: ${$}`), Pt.config({ path: $, quiet: !0, override: !0 });
3471
3472
  try {
3472
- const {
3473
- finalParser: m,
3474
- parserChain: h
3475
- } = this.#h(
3473
+ const { finalParser: m, parserChain: h } = this.#h(
3476
3474
  e,
3477
3475
  this,
3478
3476
  [],
3479
3477
  [this]
3480
- ), w = m.#i.loadEnvFile(
3478
+ ), S = m.#i.loadEnvFile(
3481
3479
  $,
3482
3480
  h
3483
3481
  );
3484
- if (w) {
3482
+ if (S) {
3485
3483
  const y = m.#i.mergeEnvConfigWithArgs(
3486
- w,
3484
+ S,
3487
3485
  e,
3488
3486
  h
3489
3487
  );
@@ -3534,7 +3532,7 @@ class V {
3534
3532
  ), console.log(
3535
3533
  `Identified Final Parser: ${g.cyan(f.#n || f.#t)}`
3536
3534
  );
3537
- let m = this, h = [...e], w = {};
3535
+ let m = this, h = [...e], S = {};
3538
3536
  const y = [], C = h.findIndex(
3539
3537
  (P) => m.#s.has(P)
3540
3538
  ), M = C === -1 ? h : h.slice(0, C);
@@ -3544,7 +3542,7 @@ class V {
3544
3542
  M,
3545
3543
  { skipHelpHandling: !0 }
3546
3544
  );
3547
- y[0].parsed = P, w = { ...w, ...P };
3545
+ y[0].parsed = P, S = { ...S, ...P };
3548
3546
  } catch (P) {
3549
3547
  y[0].error = P.message;
3550
3548
  }
@@ -3573,7 +3571,7 @@ class V {
3573
3571
  const { parsedArgs: G } = await m.#E(O, {
3574
3572
  skipHelpHandling: !0
3575
3573
  });
3576
- j.parsed = G, w = { ...w, ...G };
3574
+ j.parsed = G, S = { ...S, ...G };
3577
3575
  } catch (G) {
3578
3576
  j.error = G.message;
3579
3577
  }
@@ -3593,7 +3591,7 @@ Parsing Simulation Steps:`)), y.forEach((P) => {
3593
3591
  `
3594
3592
  Final Accumulated Args State (before final validation):`
3595
3593
  )
3596
- ), this.#e.info(JSON.stringify(w, null, 2)), this.#e.info(
3594
+ ), this.#e.info(JSON.stringify(S, null, 2)), this.#e.info(
3597
3595
  g.yellow(`
3598
3596
  Arguments Remaining After Simulation:`)
3599
3597
  ), this.#e.info(JSON.stringify(h, null, 2)), this.#e.info(
@@ -3603,10 +3601,10 @@ Arguments Remaining After Simulation:`)
3603
3601
  )
3604
3602
  ), f.printAll(), this.#e.info(g.yellow.bold("--- End ArgParser --s-debug ---")), this._handleExit(0, "Debug information displayed", "debug");
3605
3603
  }
3606
- let v = "undefined_parser";
3607
- if (f instanceof V ? v = f.getSubCommandName() || f.getAppName() || "unknown" : f && (v = f.name || f.appName || "unknown_type"), !(f instanceof V))
3604
+ let w = "undefined_parser";
3605
+ if (f instanceof V ? w = f.getSubCommandName() || f.getAppName() || "unknown" : f && (w = f.name || f.appName || "unknown_type"), !(f instanceof V))
3608
3606
  return console.error(
3609
- `[ArgParser #_handleGlobalChecks Critical Error] identifiedFinalParser is not an instance of ArgParser. Cannot process help. Name: ${v}, Constructor: ${f ? f.constructor?.name : "undefined"}`
3607
+ `[ArgParser #_handleGlobalChecks Critical Error] identifiedFinalParser is not an instance of ArgParser. Cannot process help. Name: ${w}, Constructor: ${f ? f.constructor?.name : "undefined"}`
3610
3608
  ), !1;
3611
3609
  const x = f.#r.getFlag("help");
3612
3610
  if (x && !t?.skipHelpHandling) {
@@ -3633,9 +3631,9 @@ Arguments Remaining After Simulation:`)
3633
3631
  p.#u && p.#r.hasFlag(f.name) && (d = !0);
3634
3632
  }
3635
3633
  if (d || !(typeof f.mandatory == "function" ? f.mandatory(e) : f.mandatory)) continue;
3636
- const v = e[f.name];
3634
+ const w = e[f.name];
3637
3635
  let x = !1;
3638
- f.allowMultiple ? (v === void 0 || Array.isArray(v) && v.length === 0) && (x = !0) : v === void 0 && (x = !0), x && (o.has(f.name) || (n.push({
3636
+ f.allowMultiple ? (w === void 0 || Array.isArray(w) && w.length === 0) && (x = !0) : w === void 0 && (x = !0), x && (o.has(f.name) || (n.push({
3639
3637
  name: f.name,
3640
3638
  parserName: l.#n || l.#t,
3641
3639
  commandChain: c
@@ -3839,9 +3837,9 @@ Arguments Remaining After Simulation:`)
3839
3837
  async _parseRecursive(e, t, r, n, o, s) {
3840
3838
  let a = -1, l = null;
3841
3839
  for (let h = 0; h < e.length; h++) {
3842
- const w = e[h];
3843
- if (t.#s.has(w)) {
3844
- a = h, l = w;
3840
+ const S = e[h];
3841
+ if (t.#s.has(S)) {
3842
+ a = h, l = S;
3845
3843
  break;
3846
3844
  }
3847
3845
  }
@@ -3861,7 +3859,7 @@ Arguments Remaining After Simulation:`)
3861
3859
  }
3862
3860
  const h = { ...u };
3863
3861
  n.length > 0 && (h.$commandChain = n);
3864
- let w;
3862
+ let S;
3865
3863
  const y = {
3866
3864
  args: f,
3867
3865
  parentArgs: r,
@@ -3877,13 +3875,13 @@ Arguments Remaining After Simulation:`)
3877
3875
  logger: this.#e,
3878
3876
  isMcp: o?.isMcp || !1
3879
3877
  };
3880
- return t.#d ? w = {
3878
+ return t.#d ? S = {
3881
3879
  handler: t.#d,
3882
3880
  context: y
3883
- } : t.#v && (w = {
3881
+ } : t.#v && (S = {
3884
3882
  handler: (C) => C.displayHelp(),
3885
3883
  context: y
3886
- }), { finalArgs: h, handlerToExecute: w };
3884
+ }), { finalArgs: h, handlerToExecute: S };
3887
3885
  }
3888
3886
  if (d < c.length) {
3889
3887
  const h = c[d];
@@ -3892,13 +3890,13 @@ Arguments Remaining After Simulation:`)
3892
3890
  n
3893
3891
  );
3894
3892
  }
3895
- const v = t.#s.get(l);
3896
- if (!v || !(v.parser instanceof V))
3893
+ const w = t.#s.get(l);
3894
+ if (!w || !(w.parser instanceof V))
3897
3895
  throw new se(
3898
3896
  `Internal error: Subcommand '${l}' is misconfigured or its parser is not a valid ArgParser instance.`,
3899
3897
  n
3900
3898
  );
3901
- const x = v.parser, p = e.slice(a + 1), $ = [...n, l], m = {
3899
+ const x = w.parser, p = e.slice(a + 1), $ = [...n, l], m = {
3902
3900
  ...r,
3903
3901
  ...f
3904
3902
  };
@@ -3933,10 +3931,10 @@ Arguments Remaining After Simulation:`)
3933
3931
  );
3934
3932
  for (let u = 0; u < e.length; u++) {
3935
3933
  if (c.has(u)) continue;
3936
- const v = d.exec(`${e[u]}`);
3937
- if (v?.groups?.arg && (await this._addToOutput(
3934
+ const w = d.exec(`${e[u]}`);
3935
+ if (w?.groups?.arg && (await this._addToOutput(
3938
3936
  f,
3939
- v.groups.arg,
3937
+ w.groups.arg,
3940
3938
  l,
3941
3939
  t
3942
3940
  ), c.add(u), !f.allowMultiple))
@@ -3946,19 +3944,19 @@ Arguments Remaining After Simulation:`)
3946
3944
  for (const f of n)
3947
3945
  for (let d = 0; d < e.length; d++) {
3948
3946
  if (c.has(d)) continue;
3949
- const u = e[d], v = d + 1, x = v < e.length, p = x ? e[v] : void 0, $ = typeof p == "string" && p.startsWith("-");
3947
+ const u = e[d], w = d + 1, x = w < e.length, p = x ? e[w] : void 0, $ = typeof p == "string" && p.startsWith("-");
3950
3948
  if (f.options.includes(u) && (c.add(d), f.flagOnly ? await this._addToOutput(f, !0, l, t) : x && !$ ? (await this._addToOutput(
3951
3949
  f,
3952
3950
  p,
3953
3951
  l,
3954
3952
  t
3955
- ), c.add(v)) : f.type === Boolean && await this._addToOutput(f, !0, l, t), !f.allowMultiple))
3953
+ ), c.add(w)) : f.type === Boolean && await this._addToOutput(f, !0, l, t), !f.allowMultiple))
3956
3954
  break;
3957
3955
  }
3958
3956
  for (const f of n) {
3959
3957
  const d = l[f.name];
3960
3958
  if (!(f.allowMultiple ? Array.isArray(d) && d.length > 0 : d !== void 0)) continue;
3961
- const v = (p) => {
3959
+ const w = (p) => {
3962
3960
  Array.isArray(p) && p.length && this.#I(p);
3963
3961
  }, x = f.dynamicRegister;
3964
3962
  if (typeof x == "function") {
@@ -3968,9 +3966,9 @@ Arguments Remaining After Simulation:`)
3968
3966
  parser: this,
3969
3967
  processArgs: e,
3970
3968
  forHelp: !!t?.dynamicHelpPreload,
3971
- registerFlags: v
3969
+ registerFlags: w
3972
3970
  }), $ = p && typeof p.then == "function" ? await p : p;
3973
- Array.isArray($) && v($);
3971
+ Array.isArray($) && w($);
3974
3972
  }
3975
3973
  }
3976
3974
  r = this.#r.flags;
@@ -4005,8 +4003,8 @@ Arguments Remaining After Simulation:`)
4005
4003
  for (const l of r)
4006
4004
  for (let c = 0; c < e.length; c++) {
4007
4005
  if (s.has(c)) continue;
4008
- const f = e[c], d = c + 1, u = d < e.length, v = u ? e[d] : void 0, x = typeof v == "string" && v.startsWith("-");
4009
- if (l.options.includes(f) && (s.add(c), l.flagOnly ? await this._addToOutput(l, !0, o, t) : u && !x ? (await this._addToOutput(l, v, o, t), s.add(d)) : l.type === Boolean && await this._addToOutput(l, !0, o, t), !l.allowMultiple))
4006
+ const f = e[c], d = c + 1, u = d < e.length, w = u ? e[d] : void 0, x = typeof w == "string" && w.startsWith("-");
4007
+ if (l.options.includes(f) && (s.add(c), l.flagOnly ? await this._addToOutput(l, !0, o, t) : u && !x ? (await this._addToOutput(l, w, o, t), s.add(d)) : l.type === Boolean && await this._addToOutput(l, !0, o, t), !l.allowMultiple))
4010
4008
  break;
4011
4009
  }
4012
4010
  let a = e.length;
@@ -4032,28 +4030,31 @@ Arguments Remaining After Simulation:`)
4032
4030
  `);
4033
4031
  const f = (u = 1) => " ".repeat(u);
4034
4032
  this.#s.size > 0 && (c += `${e("Available sub-commands:")}
4035
- `, c += Array.from(this.#s.entries()).sort(([u], [v]) => u.localeCompare(v)).map(([u, v]) => {
4036
- const x = v.parser;
4033
+ `, c += Array.from(this.#s.entries()).sort(([u], [w]) => u.localeCompare(w)).map(([u, w]) => {
4034
+ const x = w.parser;
4037
4035
  if (!(x instanceof V))
4038
4036
  return `${f()}${t(u.padEnd(20))} [Error: Subcommand '${u}' has an invalid parser configuration]`;
4039
- let p = `${f()}${t(u.padEnd(20))} ${r(x.#c || "")}`;
4040
- const m = ((x && x.#r ? x.#r.flags : void 0) || []).filter(
4041
- (w) => w.name !== "help"
4037
+ let p = `${f()}${t(u)}`;
4038
+ const $ = x.#c;
4039
+ $ && (p += `
4040
+ ${f(2)}${r($)}`);
4041
+ const h = ((x && x.#r ? x.#r.flags : void 0) || []).filter(
4042
+ (y) => y.name !== "help"
4042
4043
  );
4043
- m.length > 0 ? (p += `
4044
- ${f(2)}${o("Flags:")}`, m.sort(
4045
- (w, y) => w.name.localeCompare(y.name)
4046
- ).forEach((w) => {
4047
- const y = w.options.map((M) => t(M)).join(", "), C = Array.isArray(w.description) ? w.description[0] : w.description;
4044
+ h.length > 0 ? (p += `
4045
+ ${f(2)}${o("Flags:")}`, h.sort(
4046
+ (y, C) => y.name.localeCompare(C.name)
4047
+ ).forEach((y) => {
4048
+ const C = y.options.map((P) => t(P)).join(", "), M = Array.isArray(y.description) ? y.description[0] : y.description;
4048
4049
  p += `
4049
- ${f(3)}${y} - ${o(C)}`;
4050
+ ${f(3)}${C} - ${o(M)}`;
4050
4051
  })) : p += `
4051
4052
  ${f(2)}${o("Flags:")} none`;
4052
- const h = Array.from(
4053
+ const S = Array.from(
4053
4054
  x.#s.keys()
4054
4055
  );
4055
- return h.length > 0 ? p += `
4056
- ${f(2)}${o("Sub-commands:")} ${h.join(", ")}` : p += `
4056
+ return S.length > 0 ? p += `
4057
+ ${f(2)}${o("Sub-commands:")} ${S.join(", ")}` : p += `
4057
4058
  ${f(2)}${o("Sub-commands:")} none`, p;
4058
4059
  }).join(`
4059
4060
 
@@ -4062,22 +4063,22 @@ ${f(2)}${o("Sub-commands:")} none`, p;
4062
4063
  ${e("Flags:")}
4063
4064
  `;
4064
4065
  const d = this.#r.flags;
4065
- return d.length > 0 ? c += d.sort((u, v) => u.name.localeCompare(v.name)).map((u) => {
4066
- const v = u.options.slice().sort((M, P) => M.length - P.length).map((M) => t(M)).join(", "), x = typeof u.mandatory == "function" ? "dynamic" : u.mandatory, p = x === !0 ? ` ${n(this.#a.mandatoryCharacter || "*")}` : x === "dynamic" ? ` ${o("(conditionally mandatory)")}` : "", $ = Array.isArray(u.description) ? u.description : [u.description], m = [];
4067
- let h = "unknown", w = [];
4066
+ return d.length > 0 ? c += d.sort((u, w) => u.name.localeCompare(w.name)).map((u) => {
4067
+ const w = u.options.slice().sort((M, P) => M.length - P.length).map((M) => t(M)).join(", "), x = typeof u.mandatory == "function" ? "dynamic" : u.mandatory, p = x === !0 ? ` ${n(this.#a.mandatoryCharacter || "*")}` : x === "dynamic" ? ` ${o("(conditionally mandatory)")}` : "", $ = Array.isArray(u.description) ? u.description : [u.description], m = [];
4068
+ let h = "unknown", S = [];
4068
4069
  if (u.type && typeof u.type == "object" && u.type._def) {
4069
4070
  h = "JSON object";
4070
4071
  try {
4071
4072
  const P = u.type._def;
4072
4073
  if (P.shape) {
4073
4074
  const T = typeof P.shape == "function" ? P.shape() : P.shape, D = Object.keys(T);
4074
- D.length > 0 && (D.length <= 4 ? w.push(`Properties: ${D.join(", ")}`) : w.push(
4075
+ D.length > 0 && (D.length <= 4 ? S.push(`Properties: ${D.join(", ")}`) : S.push(
4075
4076
  `Properties: ${D.slice(0, 4).join(", ")}, ... (${D.length} total)`
4076
4077
  ));
4077
4078
  }
4078
- w.push("Expected: JSON string");
4079
+ S.push("Expected: JSON string");
4079
4080
  } catch {
4080
- w.push("Expected: JSON string");
4081
+ S.push("Expected: JSON string");
4081
4082
  }
4082
4083
  } else typeof u.type == "function" ? (h = u.type.name || "custom function", h === "Boolean" && (h = "boolean"), h === "String" && (h = "string"), h === "Number" && (h = "number"), h === "Array" && (h = "array"), h === "Object" && (h = "object")) : typeof u.type == "string" && (h = u.type);
4083
4084
  m.push(`Type: ${h}`);
@@ -4102,7 +4103,7 @@ ${e("Flags:")}
4102
4103
  m.push(`Example: ${P} ${D}`);
4103
4104
  }
4104
4105
  }
4105
- w.length > 0 && m.push(...w), u.flagOnly && m.push("Flag only (no value expected)"), u.defaultValue !== void 0 && u.defaultValue !== null && m.push(`Default: ${JSON.stringify(u.defaultValue)}`), u.enum && u.enum.length > 0 && m.push(
4106
+ S.length > 0 && m.push(...S), u.flagOnly && m.push("Flag only (no value expected)"), u.defaultValue !== void 0 && u.defaultValue !== null && m.push(`Default: ${JSON.stringify(u.defaultValue)}`), u.enum && u.enum.length > 0 && m.push(
4106
4107
  `Allowed values: ${u.enum.map((M) => `'${M}'`).join(", ")}`
4107
4108
  );
4108
4109
  const y = Math.max(
@@ -4110,7 +4111,7 @@ ${e("Flags:")}
4110
4111
  (M) => M.options.join(", ").length
4111
4112
  ),
4112
4113
  0
4113
- ), C = v.padEnd(y + 5) + p;
4114
+ ), C = w.padEnd(y + 5) + p;
4114
4115
  return `
4115
4116
  ${f()}${C}
4116
4117
  ${f(2)}${r($[0])}
@@ -4707,7 +4708,7 @@ ${g.dim(`Try '${t} --help' for usage details.`)}`
4707
4708
  return t;
4708
4709
  }
4709
4710
  }
4710
- const tn = async (i) => {
4711
+ const nn = async (i) => {
4711
4712
  i.displayHelp();
4712
4713
  };
4713
4714
  function We(i) {
@@ -4716,7 +4717,7 @@ function We(i) {
4716
4717
  let e = i.replace(/[^a-zA-Z0-9_-]/g, "_");
4717
4718
  return (!e || /^_+$/.test(e)) && (e = "tool"), e.length > 64 && (e = e.substring(0, 64)), e;
4718
4719
  }
4719
- function rn(i) {
4720
+ function on(i) {
4720
4721
  return !i || typeof i != "string" ? !1 : /^[a-zA-Z0-9_-]{1,64}$/.test(i);
4721
4722
  }
4722
4723
  const F = ne("MCP Integration");
@@ -4743,11 +4744,11 @@ function ge(i) {
4743
4744
  structuredContent: t
4744
4745
  };
4745
4746
  }
4746
- function cr(i) {
4747
+ function ur(i) {
4747
4748
  if (i.type && typeof i.type == "object" && i.type._def) {
4748
4749
  const n = i.type;
4749
4750
  try {
4750
- const o = S.toJSONSchema(n);
4751
+ const o = v.toJSONSchema(n);
4751
4752
  i.description && (o.description = i.description);
4752
4753
  const s = !!(i.mandatory || i.required);
4753
4754
  return { property: o, isRequired: s };
@@ -4775,12 +4776,12 @@ function cr(i) {
4775
4776
  const r = !!(i.mandatory || i.required);
4776
4777
  return { property: e, isRequired: r };
4777
4778
  }
4778
- function nn(i) {
4779
+ function sn(i) {
4779
4780
  const e = {}, t = [];
4780
4781
  for (const r of i) {
4781
4782
  if (r.name === "help" || r.name.startsWith("s-"))
4782
4783
  continue;
4783
- const { property: n, isRequired: o } = cr(r);
4784
+ const { property: n, isRequired: o } = ur(r);
4784
4785
  e[r.name] = n, o && t.push(r.name);
4785
4786
  }
4786
4787
  return {
@@ -4797,9 +4798,9 @@ function ct(i) {
4797
4798
  const r = bt(t);
4798
4799
  e[t.name] = r;
4799
4800
  }
4800
- return S.object(e);
4801
+ return v.object(e);
4801
4802
  }
4802
- function ur(i) {
4803
+ function fr(i) {
4803
4804
  if (typeof i == "object" && i !== null && "success" in i)
4804
4805
  return {
4805
4806
  success: i.success,
@@ -4851,62 +4852,62 @@ function bt(i) {
4851
4852
  const e = i.type;
4852
4853
  if (e && typeof e == "object" && e._def)
4853
4854
  return e;
4854
- let t = S.string(), r;
4855
+ let t = v.string(), r;
4855
4856
  typeof e == "function" ? r = e.name.toLowerCase().replace("constructor", "") : r = String(e).toLowerCase();
4856
4857
  const n = i.enum;
4857
4858
  if (i.allowMultiple) {
4858
4859
  let l;
4859
4860
  if (n && Array.isArray(n) && n.length > 0)
4860
4861
  if (n.every((c) => typeof c == "string"))
4861
- l = S.enum(n);
4862
+ l = v.enum(n);
4862
4863
  else if (n.every((c) => typeof c == "number")) {
4863
- const c = n.map((f) => S.literal(f));
4864
- c.length === 1 ? l = c[0] : l = S.union(
4864
+ const c = n.map((f) => v.literal(f));
4865
+ c.length === 1 ? l = c[0] : l = v.union(
4865
4866
  c
4866
4867
  );
4867
4868
  } else
4868
- l = S.string();
4869
+ l = v.string();
4869
4870
  else
4870
4871
  switch (r) {
4871
4872
  case "number":
4872
- l = S.number();
4873
+ l = v.number();
4873
4874
  break;
4874
4875
  case "boolean":
4875
- l = S.boolean();
4876
+ l = v.boolean();
4876
4877
  break;
4877
4878
  default:
4878
- l = S.string();
4879
+ l = v.string();
4879
4880
  break;
4880
4881
  }
4881
- t = S.array(l);
4882
+ t = v.array(l);
4882
4883
  } else
4883
4884
  switch (r) {
4884
4885
  case "string":
4885
- t = n && Array.isArray(n) && n.length > 0 && n.every((c) => typeof c == "string") ? S.enum(n) : S.string();
4886
+ t = n && Array.isArray(n) && n.length > 0 && n.every((c) => typeof c == "string") ? v.enum(n) : v.string();
4886
4887
  break;
4887
4888
  case "number":
4888
4889
  if (n && Array.isArray(n) && n.length > 0 && n.every((c) => typeof c == "number")) {
4889
- const c = n.map((f) => S.literal(f));
4890
- c.length === 1 ? t = c[0] : c.length >= 2 ? t = S.union(
4890
+ const c = n.map((f) => v.literal(f));
4891
+ c.length === 1 ? t = c[0] : c.length >= 2 ? t = v.union(
4891
4892
  c
4892
- ) : t = S.number();
4893
+ ) : t = v.number();
4893
4894
  } else
4894
- t = S.number();
4895
+ t = v.number();
4895
4896
  break;
4896
4897
  case "boolean":
4897
- t = S.boolean();
4898
+ t = v.boolean();
4898
4899
  break;
4899
4900
  case "array":
4900
- const l = n && Array.isArray(n) && n.length > 0 && n.every((c) => typeof c == "string") ? S.enum(n) : S.string();
4901
- t = S.array(l);
4901
+ const l = n && Array.isArray(n) && n.length > 0 && n.every((c) => typeof c == "string") ? v.enum(n) : v.string();
4902
+ t = v.array(l);
4902
4903
  break;
4903
4904
  case "object":
4904
- t = S.record(S.string(), S.any());
4905
+ t = v.record(v.string(), v.any());
4905
4906
  break;
4906
4907
  default:
4907
4908
  F.error(
4908
4909
  `Flag '${i.name}' has an unknown type '${r}'. Defaulting to z.string().`
4909
- ), t = S.string();
4910
+ ), t = v.string();
4910
4911
  break;
4911
4912
  }
4912
4913
  const s = i.description;
@@ -4922,7 +4923,7 @@ function ut(i, e) {
4922
4923
  function n(o, s) {
4923
4924
  if (r.has(o)) return;
4924
4925
  r.add(o);
4925
- const a = i, l = o, c = a.getAppName ? a.getAppName() : a["#appName"], f = l.getDescription ? l.getDescription() : l["#description"], d = l.getHandler ? l.getHandler() : l["#handler"], u = l.flags, v = l.getSubCommands ? l.getSubCommands() : l["#subCommands"], x = v ? Array.from(v.values()) : [];
4926
+ const a = i, l = o, c = a.getAppName ? a.getAppName() : a["#appName"], f = l.getDescription ? l.getDescription() : l["#description"], d = l.getHandler ? l.getHandler() : l["#handler"], u = l.flags, w = l.getSubCommands ? l.getSubCommands() : l["#subCommands"], x = w ? Array.from(w.values()) : [];
4926
4927
  let p = l.getAppCommandName ? l.getAppCommandName() : l["#appCommandName"];
4927
4928
  !p && o !== i && (p = l.getSubCommandName ? l.getSubCommandName() : l["#subCommandName"]), o !== i && s.length > 0 && (p = s[s.length - 1]);
4928
4929
  const $ = p || c, m = p || (s.length > 0 ? s[s.length - 1] : c);
@@ -4934,11 +4935,11 @@ function ut(i, e) {
4934
4935
  let j = bt(O);
4935
4936
  M && O.mandatory && (j = j.optional()), C[O.name] = j;
4936
4937
  }
4937
- const P = S.object(C);
4938
+ const P = v.object(C);
4938
4939
  let T;
4939
4940
  if (e?.outputSchemaMap && e.outputSchemaMap[h]) {
4940
4941
  const O = e.outputSchemaMap[h];
4941
- T = typeof O == "object" && O !== null && !O._def ? S.object(O) : O;
4942
+ T = typeof O == "object" && O !== null && !O._def ? v.object(O) : O;
4942
4943
  } else e?.defaultOutputSchema ? T = e.defaultOutputSchema : e?.autoGenerateOutputSchema && (typeof e.autoGenerateOutputSchema == "string" ? T = fe(e.autoGenerateOutputSchema) : e.autoGenerateOutputSchema === !0 && (T = fe("successWithData")));
4943
4944
  const D = {
4944
4945
  name: h,
@@ -5380,7 +5381,7 @@ function ut(i, e) {
5380
5381
  async executeForTesting(O) {
5381
5382
  try {
5382
5383
  const j = await this.execute(O);
5383
- return ur(j);
5384
+ return fr(j);
5384
5385
  } catch (j) {
5385
5386
  return {
5386
5387
  success: !1,
@@ -5392,9 +5393,9 @@ function ut(i, e) {
5392
5393
  };
5393
5394
  t.push(D);
5394
5395
  }
5395
- const w = x;
5396
- if (w && e?.includeSubCommands !== !1)
5397
- for (const y of w) {
5396
+ const S = x;
5397
+ if (S && e?.includeSubCommands !== !1)
5398
+ for (const y of S) {
5398
5399
  if (y.isMcp === !0)
5399
5400
  continue;
5400
5401
  const C = [...s, y.name];
@@ -5406,8 +5407,8 @@ function ut(i, e) {
5406
5407
  }
5407
5408
  return n(i, []), t;
5408
5409
  }
5409
- const fr = "2025-06-18";
5410
- function dr(i, e) {
5410
+ const dr = "2025-06-18";
5411
+ function pr(i, e) {
5411
5412
  return i === e ? 0 : i < e ? -1 : 1;
5412
5413
  }
5413
5414
  const X = ne("Zod Compatibility");
@@ -5428,7 +5429,7 @@ function dt(i) {
5428
5429
  }
5429
5430
  class ye extends V {
5430
5431
  constructor() {
5431
- super(...arguments), this._mcpTools = /* @__PURE__ */ new Map(), this._tools = /* @__PURE__ */ new Map(), this._outputSchemaMap = /* @__PURE__ */ new Map(), this._mcpProtocolVersion = fr;
5432
+ super(...arguments), this._mcpTools = /* @__PURE__ */ new Map(), this._tools = /* @__PURE__ */ new Map(), this._outputSchemaMap = /* @__PURE__ */ new Map(), this._mcpProtocolVersion = dr;
5432
5433
  }
5433
5434
  /**
5434
5435
  * Get the stored MCP server configuration
@@ -5516,7 +5517,7 @@ class ye extends V {
5516
5517
  * @returns true if output schemas are supported
5517
5518
  */
5518
5519
  supportsOutputSchemas() {
5519
- return dr(this._mcpProtocolVersion, "2025-06-18") >= 0;
5520
+ return pr(this._mcpProtocolVersion, "2025-06-18") >= 0;
5520
5521
  }
5521
5522
  /**
5522
5523
  * Add a unified tool that works in both CLI and MCP modes
@@ -5745,7 +5746,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5745
5746
  debug: (...m) => d.error(`[${l.name}]`, ...m)
5746
5747
  }, globalThis.console = u;
5747
5748
  }
5748
- const v = {
5749
+ const w = {
5749
5750
  args: f,
5750
5751
  parentArgs: {},
5751
5752
  commandChain: [l.name],
@@ -5755,7 +5756,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5755
5756
  displayHelp: () => {
5756
5757
  this.logger.error("Help display is not supported in MCP mode.");
5757
5758
  }
5758
- }, x = Date.now(), p = await l.handler(v), $ = Date.now() - x;
5759
+ }, x = Date.now(), p = await l.handler(w), $ = Date.now() - x;
5759
5760
  return process.env.MCP_DEBUG && this.logger.error(
5760
5761
  `[MCP Tool] '${l.name}' executed successfully in ${$}ms`
5761
5762
  ), p && typeof p == "object" && "content" in p ? (c && this.supportsOutputSchemas() && !p.structuredContent && (p.structuredContent = p), p) : c && this.supportsOutputSchemas() && p && typeof p == "object" ? {
@@ -5767,9 +5768,9 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5767
5768
  ],
5768
5769
  structuredContent: p
5769
5770
  } : He(p);
5770
- } catch (v) {
5771
- const x = `Tool '${l.name}' execution failed: ${v instanceof Error ? v.message : String(v)}`;
5772
- return process.env.MCP_DEBUG && (this.logger.error(`[MCP Tool Error] ${x}`), v instanceof Error && v.stack && this.logger.error(`[MCP Tool Stack] ${v.stack}`)), ge(x);
5771
+ } catch (w) {
5772
+ const x = `Tool '${l.name}' execution failed: ${w instanceof Error ? w.message : String(w)}`;
5773
+ return process.env.MCP_DEBUG && (this.logger.error(`[MCP Tool Error] ${x}`), w instanceof Error && w.stack && this.logger.error(`[MCP Tool Stack] ${w.stack}`)), ge(x);
5773
5774
  } finally {
5774
5775
  globalThis.console = d;
5775
5776
  }
@@ -5780,7 +5781,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5780
5781
  ).map((l) => ({
5781
5782
  name: l.name,
5782
5783
  description: l.description || `Executes the ${l.name} tool.`,
5783
- inputSchema: l.inputSchema || S.object({}),
5784
+ inputSchema: l.inputSchema || v.object({}),
5784
5785
  outputSchema: l.outputSchema,
5785
5786
  execute: async (c) => {
5786
5787
  try {
@@ -5847,7 +5848,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5847
5848
  o.mcpError("Successfully created McpServer instance");
5848
5849
  const f = process.argv.includes("--s-mcp-serve");
5849
5850
  if (this._mcpServerConfig?.lifecycle && !f) {
5850
- const { McpLifecycleManager: p } = await Promise.resolve().then(() => Sr), $ = new p(
5851
+ const { McpLifecycleManager: p } = await Promise.resolve().then(() => xr), $ = new p(
5851
5852
  this._mcpServerConfig.lifecycle,
5852
5853
  o,
5853
5854
  s,
@@ -5856,10 +5857,10 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5856
5857
  try {
5857
5858
  const h = process.argv.slice(2).filter(
5858
5859
  (C) => !C.startsWith("--s-mcp-") && C !== "--s-mcp-serve"
5859
- ), w = await this.parse(h, {
5860
+ ), S = await this.parse(h, {
5860
5861
  skipHandlerExecution: !0,
5861
5862
  isMcp: !0
5862
- }), y = w?.args || w || {};
5863
+ }), y = S?.args || S || {};
5863
5864
  $.setParsedArgs(y), o.mcpError(
5864
5865
  `Lifecycle manager initialized with parsed args: ${Object.keys(y).join(", ")}`
5865
5866
  );
@@ -5871,7 +5872,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5871
5872
  const m = c.connect.bind(c);
5872
5873
  c.connect = async (h) => {
5873
5874
  o.mcpError("MCP server connecting with lifecycle events...");
5874
- const w = await m(h);
5875
+ const S = await m(h);
5875
5876
  try {
5876
5877
  await $.handleInitialize(
5877
5878
  { name: "mcp-client", version: "1.0.0" },
@@ -5894,7 +5895,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5894
5895
  `Lifecycle onInitialize error: ${y instanceof Error ? y.message : String(y)}`
5895
5896
  );
5896
5897
  }
5897
- return w;
5898
+ return S;
5898
5899
  }, c._lifecycleManager = $, o.mcpError("Successfully set up MCP lifecycle manager");
5899
5900
  }
5900
5901
  o.mcpError(
@@ -5913,12 +5914,12 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5913
5914
  ), h = Array.from(this._mcpTools.values()).find(
5914
5915
  (M) => M.name === p.name
5915
5916
  );
5916
- m && m.flags ? $ = ct(m.flags) : h && h.inputSchema ? $ = h.inputSchema : $ = S.object({});
5917
- let w;
5917
+ m && m.flags ? $ = ct(m.flags) : h && h.inputSchema ? $ = h.inputSchema : $ = v.object({});
5918
+ let S;
5918
5919
  try {
5919
5920
  process.env.MCP_DEBUG && (this.logger.error(
5920
5921
  `[MCP Debug] Preparing schema for tool ${p.name}`
5921
- ), this.logger.error("[MCP Debug] Input zodSchema:", $)), w = $, process.env.MCP_DEBUG && this.logger.error(
5922
+ ), this.logger.error("[MCP Debug] Input zodSchema:", $)), S = $, process.env.MCP_DEBUG && this.logger.error(
5922
5923
  `[MCP Debug] Successfully prepared schema for tool ${p.name}`
5923
5924
  );
5924
5925
  } catch (M) {
@@ -5929,32 +5930,32 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5929
5930
  }
5930
5931
  process.env.MCP_DEBUG && (this.logger.error(
5931
5932
  `[MCP Debug] Prepared mcpCompatibleSchema for tool ${p.name}:`,
5932
- JSON.stringify(w, null, 2)
5933
+ JSON.stringify(S, null, 2)
5933
5934
  ), this.logger.error(
5934
5935
  "[MCP Debug] Schema properties:",
5935
- Object.keys(w || {})
5936
+ Object.keys(S || {})
5936
5937
  ), this.logger.error(
5937
5938
  "[MCP Debug] Schema def:",
5938
- w?.def
5939
+ S?.def
5939
5940
  ), this.logger.error(
5940
5941
  "[MCP Debug] Schema shape:",
5941
- w?.shape
5942
+ S?.shape
5942
5943
  ), this.logger.error(
5943
5944
  "[MCP Debug] Schema parse function:",
5944
- typeof w?.parse
5945
+ typeof S?.parse
5945
5946
  )), process.env.MCP_DEBUG && (this.logger.error(
5946
5947
  `[MCP Debug] About to prepare schema for tool ${p.name}`
5947
5948
  ), this.logger.error("[MCP Debug] zodSchema type:", typeof $), this.logger.error("[MCP Debug] zodSchema:", $), this.logger.error(
5948
5949
  "[MCP Debug] zodSchema constructor:",
5949
5950
  $?.constructor?.name
5950
- )), ft(w, `Tool ${p.name} schema`), dt(w) || o.mcpError(
5951
+ )), ft(S, `Tool ${p.name} schema`), dt(S) || o.mcpError(
5951
5952
  `Warning: Schema for tool ${p.name} may not be fully compatible with MCP SDK`
5952
5953
  );
5953
5954
  const y = {
5954
5955
  title: p.name,
5955
5956
  // MCP SDK requires title field
5956
5957
  description: p.description || "No description provided.",
5957
- inputSchema: w
5958
+ inputSchema: S
5958
5959
  // Use Zod v3 compatible schema for MCP SDK
5959
5960
  };
5960
5961
  if (process.env.MCP_DEBUG && (this.logger.error(
@@ -5977,13 +5978,13 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5977
5978
  y.inputSchema?._zod
5978
5979
  ), this.logger.error(
5979
5980
  "[MCP Debug] Schema keys:",
5980
- Object.keys(w || {})
5981
+ Object.keys(S || {})
5981
5982
  ), this.logger.error(
5982
5983
  "[MCP Debug] About to call server.registerTool with:",
5983
5984
  {
5984
5985
  name: p.name,
5985
5986
  description: p.description,
5986
- inputSchema: w
5987
+ inputSchema: S
5987
5988
  }
5988
5989
  )), p.outputSchema && this.supportsOutputSchemas()) {
5989
5990
  const M = fe(p.outputSchema);
@@ -6037,8 +6038,8 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6037
6038
  };
6038
6039
  c.registerTool(p.name, y, C);
6039
6040
  }), o.mcpError("Successfully registered all tools with MCP server");
6040
- const v = this.getMcpResources();
6041
- o.mcpError(`Registering ${v.length} MCP resources`), v.forEach((p) => {
6041
+ const w = this.getMcpResources();
6042
+ o.mcpError(`Registering ${w.length} MCP resources`), w.forEach((p) => {
6042
6043
  try {
6043
6044
  const $ = {
6044
6045
  title: p.title || p.name,
@@ -6049,11 +6050,11 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6049
6050
  const m = new l(
6050
6051
  p.uriTemplate,
6051
6052
  { list: void 0 }
6052
- ), h = async (w, y = {}) => {
6053
+ ), h = async (S, y = {}) => {
6053
6054
  try {
6054
6055
  return {
6055
6056
  contents: (await p.handler(
6056
- new URL(w.href || w),
6057
+ new URL(S.href || S),
6057
6058
  y
6058
6059
  )).contents.map((M) => {
6059
6060
  const P = {
@@ -6088,10 +6089,10 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6088
6089
  return y.text !== void 0 && (C.text = y.text), y.blob !== void 0 && (C.blob = y.blob), y.mimeType !== void 0 && (C.mimeType = y.mimeType), C;
6089
6090
  })
6090
6091
  };
6091
- } catch (w) {
6092
+ } catch (S) {
6092
6093
  throw o.mcpError(
6093
- `Resource handler error for ${p.name}: ${w instanceof Error ? w.message : String(w)}`
6094
- ), w;
6094
+ `Resource handler error for ${p.name}: ${S instanceof Error ? S.message : String(S)}`
6095
+ ), S;
6095
6096
  }
6096
6097
  };
6097
6098
  c.registerResource(
@@ -6121,11 +6122,11 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6121
6122
  )), $ = p.argsSchema, process.env.MCP_DEBUG && this.logger.error(
6122
6123
  `[MCP Debug] Successfully prepared schema for prompt ${p.name}`
6123
6124
  );
6124
- } catch (w) {
6125
+ } catch (S) {
6125
6126
  throw this.logger.error(
6126
6127
  `[MCP Debug] Error preparing schema for prompt ${p.name}:`,
6127
- w
6128
- ), w;
6128
+ S
6129
+ ), S;
6129
6130
  }
6130
6131
  if (!dt($))
6131
6132
  throw new Error(
@@ -6138,9 +6139,9 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6138
6139
  description: p.description || "No description provided.",
6139
6140
  argsSchema: $
6140
6141
  // Use Zod v3 compatible schema for MCP SDK
6141
- }, h = async (w) => {
6142
+ }, h = async (S) => {
6142
6143
  try {
6143
- const y = p.argsSchema.parse(w), C = await p.handler(y);
6144
+ const y = p.argsSchema.parse(S), C = await p.handler(y);
6144
6145
  return process.env.MCP_DEBUG && this.logger.error(
6145
6146
  `[MCP Debug] Prompt '${p.name}' executed successfully`
6146
6147
  ), C;
@@ -6270,8 +6271,8 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6270
6271
  const { SSEServerTransport: a } = await import("@modelcontextprotocol/sdk/server/sse.js"), l = (await import("express")).default, c = l();
6271
6272
  c.use(l.json());
6272
6273
  const f = r.port || 3e3, d = r.path || "/sse";
6273
- c.get(d, (u, v) => {
6274
- const x = new a(d, v);
6274
+ c.get(d, (u, w) => {
6275
+ const x = new a(d, w);
6275
6276
  e.connect(x);
6276
6277
  }), await new Promise((u) => {
6277
6278
  c.listen(f, r.host || "localhost", () => {
@@ -6284,12 +6285,12 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6284
6285
  }
6285
6286
  case "streamable-http": {
6286
6287
  const { StreamableHTTPServerTransport: a } = await import("@modelcontextprotocol/sdk/server/streamableHttp.js"), l = (await import("express")).default, c = l();
6287
- c.disable("x-powered-by"), c.use(l.json()), c.get("/favicon.ico", (h, w) => {
6288
+ c.disable("x-powered-by"), c.use(l.json()), c.get("/favicon.ico", (h, S) => {
6288
6289
  const y = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
6289
6290
  <rect width="16" height="16" fill="white"/>
6290
6291
  <circle cx="8" cy="8" r="4" fill="red"/>
6291
6292
  </svg>`;
6292
- w.setHeader("Content-Type", "image/svg+xml"), w.setHeader("Cache-Control", "public, max-age=86400"), w.send(y);
6293
+ S.setHeader("Content-Type", "image/svg+xml"), S.setHeader("Cache-Control", "public, max-age=86400"), S.send(y);
6293
6294
  });
6294
6295
  try {
6295
6296
  this._mcpServerConfig?.httpServer?.configureExpress?.(c);
@@ -6297,7 +6298,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6297
6298
  }
6298
6299
  const f = r.port || 3e3, d = r.path || "/mcp";
6299
6300
  if (r.cors) {
6300
- const h = r.cors, w = h.methods?.join(", ") || "GET,POST,PUT,PATCH,DELETE,OPTIONS", y = (T) => h.headers?.join(", ") || T.headers["access-control-request-headers"] || "Content-Type, Authorization, MCP-Session-Id", C = h.exposedHeaders?.join(", ") || void 0, M = (T) => {
6301
+ const h = r.cors, S = h.methods?.join(", ") || "GET,POST,PUT,PATCH,DELETE,OPTIONS", y = (T) => h.headers?.join(", ") || T.headers["access-control-request-headers"] || "Content-Type, Authorization, MCP-Session-Id", C = h.exposedHeaders?.join(", ") || void 0, M = (T) => {
6301
6302
  const D = T.headers.origin, O = h.origins ?? "*";
6302
6303
  if (O === "*") return h.credentials ? D : "*";
6303
6304
  if (!D) return;
@@ -6306,7 +6307,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6306
6307
  if (typeof G == "string" && G === D || G instanceof RegExp && G.test(D)) return D;
6307
6308
  }, P = (T, D) => {
6308
6309
  const O = M(T);
6309
- O && D.setHeader("Access-Control-Allow-Origin", O), h.credentials && D.setHeader("Access-Control-Allow-Credentials", "true"), D.setHeader("Vary", "Origin"), D.setHeader("Access-Control-Allow-Methods", w);
6310
+ O && D.setHeader("Access-Control-Allow-Origin", O), h.credentials && D.setHeader("Access-Control-Allow-Credentials", "true"), D.setHeader("Vary", "Origin"), D.setHeader("Access-Control-Allow-Methods", S);
6310
6311
  const j = y(T);
6311
6312
  j && D.setHeader("Access-Control-Allow-Headers", j), C && D.setHeader("Access-Control-Expose-Headers", C), typeof h.maxAge == "number" && D.setHeader("Access-Control-Max-Age", String(h.maxAge));
6312
6313
  };
@@ -6317,18 +6318,18 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6317
6318
  });
6318
6319
  }
6319
6320
  r.auth?.customMiddleware && c.use(r.auth.customMiddleware);
6320
- const u = r.auth, v = (h) => {
6321
+ const u = r.auth, w = (h) => {
6321
6322
  if (!u) return !1;
6322
- const w = h.path, y = u.publicPaths || [], C = u.protectedPaths;
6323
- return y.includes(w) || C && !C.includes(w) ? !1 : u.required !== !1;
6323
+ const S = h.path, y = u.publicPaths || [], C = u.protectedPaths;
6324
+ return y.includes(S) || C && !C.includes(S) ? !1 : u.required !== !1;
6324
6325
  }, x = (h) => Buffer.from(h.replace(/-/g, "+").replace(/_/g, "/"), "base64"), p = async (h) => {
6325
6326
  if (!u?.jwt) return !1;
6326
- const [w, y, C] = h.split(".");
6327
- if (!w || !y || !C) return !1;
6328
- const M = JSON.parse(x(w).toString("utf8")), P = JSON.parse(x(y).toString("utf8")), T = M.alg;
6327
+ const [S, y, C] = h.split(".");
6328
+ if (!S || !y || !C) return !1;
6329
+ const M = JSON.parse(x(S).toString("utf8")), P = JSON.parse(x(y).toString("utf8")), T = M.alg;
6329
6330
  if (u.jwt.algorithms && !u.jwt.algorithms.includes(T))
6330
6331
  return !1;
6331
- const D = Buffer.from(`${w}.${y}`), O = x(C);
6332
+ const D = Buffer.from(`${S}.${y}`), O = x(C);
6332
6333
  if (T === "HS256") {
6333
6334
  const L = u.jwt.secret;
6334
6335
  if (!L || !(await import("node:crypto")).createHmac("sha256", L).update(D).digest().equals(O)) return !1;
@@ -6346,7 +6347,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6346
6347
  return !(P.nbf && j + G < P.nbf || P.exp && j - G >= P.exp);
6347
6348
  }, $ = async (h) => {
6348
6349
  if (!u) return !0;
6349
- const w = h.headers.authorization, y = w?.startsWith("Bearer ") ? w.slice(7) : void 0;
6350
+ const S = h.headers.authorization, y = S?.startsWith("Bearer ") ? S.slice(7) : void 0;
6350
6351
  if (!y)
6351
6352
  return u.validator ? !!await u.validator(h, y) : !1;
6352
6353
  if (u.scheme === "jwt" || u.jwt) {
@@ -6355,9 +6356,9 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6355
6356
  return u.validator ? !!await u.validator(h, y) : !1;
6356
6357
  return !(u.validator && !await u.validator(h, y));
6357
6358
  }, m = {};
6358
- c.all(d, async (h, w) => {
6359
- if (v(h) && !await $(h)) {
6360
- w.status(401).json({ error: "Unauthorized" });
6359
+ c.all(d, async (h, S) => {
6360
+ if (w(h) && !await $(h)) {
6361
+ S.status(401).json({ error: "Unauthorized" });
6361
6362
  return;
6362
6363
  }
6363
6364
  const y = h.headers["mcp-session-id"];
@@ -6369,7 +6370,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6369
6370
  }
6370
6371
  }), C.onclose = () => {
6371
6372
  C.sessionId && delete m[C.sessionId];
6372
- }, await e.connect(C)), await C.handleRequest(h, w, h.body);
6373
+ }, await e.connect(C)), await C.handleRequest(h, S, h.body);
6373
6374
  }), await new Promise((h) => {
6374
6375
  c.listen(f, r.host || "localhost", () => {
6375
6376
  h();
@@ -6496,13 +6497,13 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6496
6497
  ), process.exit(1)), d.mcpError("Parent parser found, casting to ArgParser");
6497
6498
  const u = f.parentParser;
6498
6499
  d.mcpError("Checking transport configuration");
6499
- const v = f.args.transports;
6500
- if (v) {
6500
+ const w = f.args.transports;
6501
+ if (w) {
6501
6502
  d.mcpError(
6502
- `Multiple transports specified via CLI: ${v}`
6503
+ `Multiple transports specified via CLI: ${w}`
6503
6504
  );
6504
6505
  try {
6505
- const x = JSON.parse(v);
6506
+ const x = JSON.parse(w);
6506
6507
  d.mcpError(
6507
6508
  `Parsed transport configs: ${JSON.stringify(x)}`
6508
6509
  ), await u.startMcpServerWithMultipleTransports(
@@ -6628,7 +6629,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6628
6629
  return o["#subCommandName"] = t["#subCommandName"], o["#parameters"] = t["#parameters"], o["#parentParser"] = t["#parentParser"], o["#lastParseResult"] = t["#lastParseResult"], o["#inheritParentFlags"] = t["#inheritParentFlags"], o["#subCommands"] = t["#subCommands"], r;
6629
6630
  }
6630
6631
  }
6631
- class pr extends ye {
6632
+ class hr extends ye {
6632
6633
  constructor(e, t) {
6633
6634
  const r = {
6634
6635
  ...e,
@@ -6647,8 +6648,8 @@ class pr extends ye {
6647
6648
  return super.parse(r, t);
6648
6649
  }
6649
6650
  }
6650
- function on(i, e) {
6651
- return pr.withMcp(i, e);
6651
+ function an(i, e) {
6652
+ return hr.withMcp(i, e);
6652
6653
  }
6653
6654
  class Oe extends Ae {
6654
6655
  constructor(e) {
@@ -6729,7 +6730,7 @@ class Oe extends Ae {
6729
6730
  return typeof e == "function" ? e.name || "custom function" : String(e).toLowerCase();
6730
6731
  }
6731
6732
  }
6732
- function hr() {
6733
+ function mr() {
6733
6734
  try {
6734
6735
  return new Oe();
6735
6736
  } catch (i) {
@@ -6739,7 +6740,7 @@ function hr() {
6739
6740
  ), null;
6740
6741
  }
6741
6742
  }
6742
- async function mr() {
6743
+ async function gr() {
6743
6744
  try {
6744
6745
  if (typeof require < "u")
6745
6746
  try {
@@ -6747,7 +6748,7 @@ async function mr() {
6747
6748
  return new Oe(e);
6748
6749
  } catch {
6749
6750
  }
6750
- const i = await Promise.resolve().then(() => Hr);
6751
+ const i = await Promise.resolve().then(() => Br);
6751
6752
  return new Oe(i);
6752
6753
  } catch (i) {
6753
6754
  return console.warn(
@@ -6756,11 +6757,11 @@ async function mr() {
6756
6757
  ), null;
6757
6758
  }
6758
6759
  }
6759
- const gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6760
+ const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6760
6761
  __proto__: null,
6761
6762
  TomlConfigPlugin: Oe,
6762
- createTomlPlugin: hr,
6763
- createTomlPluginAsync: mr
6763
+ createTomlPlugin: mr,
6764
+ createTomlPluginAsync: gr
6764
6765
  }, Symbol.toStringTag, { value: "Module" }));
6765
6766
  class _e extends Ae {
6766
6767
  constructor(e) {
@@ -6842,7 +6843,7 @@ class _e extends Ae {
6842
6843
  return t;
6843
6844
  }
6844
6845
  }
6845
- function yr() {
6846
+ function br() {
6846
6847
  try {
6847
6848
  return new _e();
6848
6849
  } catch (i) {
@@ -6852,7 +6853,7 @@ function yr() {
6852
6853
  ), null;
6853
6854
  }
6854
6855
  }
6855
- async function br() {
6856
+ async function wr() {
6856
6857
  try {
6857
6858
  if (typeof require < "u")
6858
6859
  try {
@@ -6869,13 +6870,13 @@ async function br() {
6869
6870
  ), null;
6870
6871
  }
6871
6872
  }
6872
- const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6873
+ const vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6873
6874
  __proto__: null,
6874
6875
  YamlConfigPlugin: _e,
6875
- createYamlPlugin: yr,
6876
- createYamlPluginAsync: br
6876
+ createYamlPlugin: br,
6877
+ createYamlPluginAsync: wr
6877
6878
  }, Symbol.toStringTag, { value: "Module" }));
6878
- class sn {
6879
+ class ln {
6879
6880
  constructor(e, t = {}) {
6880
6881
  this.parser = e, this.options = {
6881
6882
  maxDepth: t.maxDepth ?? 5,
@@ -7135,7 +7136,7 @@ class sn {
7135
7136
  };
7136
7137
  }
7137
7138
  }
7138
- class vr {
7139
+ class Sr {
7139
7140
  constructor(e, t, r, n) {
7140
7141
  this.events = e, this.logger = t, this.serverInfo = r, this.argParser = n, this.state = {
7141
7142
  initialized: !1,
@@ -7250,15 +7251,15 @@ class vr {
7250
7251
  return this.state.ready && !this.state.shuttingDown;
7251
7252
  }
7252
7253
  }
7253
- const Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7254
+ const xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7254
7255
  __proto__: null,
7255
- McpLifecycleManager: vr
7256
+ McpLifecycleManager: Sr
7256
7257
  }, Symbol.toStringTag, { value: "Module" }));
7257
- function xr(i, e) {
7258
+ function $r(i, e) {
7258
7259
  let t = i.slice(0, e).split(/\r\n|\n|\r/g);
7259
7260
  return [t.length, t.pop().length + 1];
7260
7261
  }
7261
- function $r(i, e, t) {
7262
+ function Er(i, e, t) {
7262
7263
  let r = i.split(/\r\n|\n|\r/g), n = "", o = (Math.log10(e + 1) | 0) + 1;
7263
7264
  for (let s = e - 1; s <= e + 1; s++) {
7264
7265
  let a = r[s - 1];
@@ -7273,13 +7274,13 @@ class N extends Error {
7273
7274
  column;
7274
7275
  codeblock;
7275
7276
  constructor(e, t) {
7276
- const [r, n] = xr(t.toml, t.ptr), o = $r(t.toml, r, n);
7277
+ const [r, n] = $r(t.toml, t.ptr), o = Er(t.toml, r, n);
7277
7278
  super(`Invalid TOML document: ${e}
7278
7279
 
7279
7280
  ${o}`, t), this.line = r, this.column = n, this.codeblock = o;
7280
7281
  }
7281
7282
  }
7282
- function Er(i, e) {
7283
+ function Cr(i, e) {
7283
7284
  let t = 0;
7284
7285
  for (; i[e - ++t] === "\\"; )
7285
7286
  ;
@@ -7315,7 +7316,7 @@ function ae(i, e, t, r) {
7315
7316
  e++;
7316
7317
  return r || n !== "#" ? e : ae(i, Fe(i, e), t);
7317
7318
  }
7318
- function Cr(i, e, t, r, n = !1) {
7319
+ function Pr(i, e, t, r, n = !1) {
7319
7320
  if (!r)
7320
7321
  return e = Be(i, e), e < 0 ? i.length : e;
7321
7322
  for (let o = e; o < i.length; o++) {
@@ -7341,10 +7342,10 @@ function wt(i, e) {
7341
7342
  e += r.length - 1;
7342
7343
  do
7343
7344
  e = i.indexOf(r, ++e);
7344
- while (e > -1 && t !== "'" && Er(i, e));
7345
+ while (e > -1 && t !== "'" && Cr(i, e));
7345
7346
  return e > -1 && (e += r.length, r.length > 1 && (i[e] === t && e++, i[e] === t && e++)), e;
7346
7347
  }
7347
- let Pr = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
7348
+ let Mr = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
7348
7349
  class de extends Date {
7349
7350
  #t = !1;
7350
7351
  #o = !1;
@@ -7352,7 +7353,7 @@ class de extends Date {
7352
7353
  constructor(e) {
7353
7354
  let t = !0, r = !0, n = "Z";
7354
7355
  if (typeof e == "string") {
7355
- let o = e.match(Pr);
7356
+ let o = e.match(Mr);
7356
7357
  o ? (o[1] || (t = !1, e = `0000-01-01T${e}`), r = !!o[2], r && e[10] === " " && (e = e.replace(" ", "T")), o[2] && +o[2] > 23 ? e = "" : (n = o[3] || null, e = e.toUpperCase(), !n && r && (e += "Z"))) : e = "";
7357
7358
  }
7358
7359
  super(e), isNaN(this.getTime()) || (this.#t = t, this.#o = r, this.#n = n);
@@ -7402,7 +7403,7 @@ class de extends Date {
7402
7403
  return t.#t = !1, t.#n = null, t;
7403
7404
  }
7404
7405
  }
7405
- let Mr = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/, Tr = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/, Dr = /^[+-]?0[0-9_]/, Or = /^[0-9a-f]{2,8}$/i, pt = {
7406
+ let Tr = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/, Dr = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/, Or = /^[+-]?0[0-9_]/, _r = /^[0-9a-f]{2,8}$/i, pt = {
7406
7407
  b: "\b",
7407
7408
  t: " ",
7408
7409
  n: `
@@ -7436,7 +7437,7 @@ function vt(i, e = 0, t = i.length) {
7436
7437
  if (s) {
7437
7438
  if (s = !1, c === "x" || c === "u" || c === "U") {
7438
7439
  let f = i.slice(e, e += c === "x" ? 2 : c === "u" ? 4 : 8);
7439
- if (!Or.test(f))
7440
+ if (!_r.test(f))
7440
7441
  throw new N("invalid unicode escape", {
7441
7442
  toml: i,
7442
7443
  ptr: o
@@ -7470,7 +7471,7 @@ function vt(i, e = 0, t = i.length) {
7470
7471
  }
7471
7472
  return a + i.slice(l, t - 1);
7472
7473
  }
7473
- function _r(i, e, t, r) {
7474
+ function Ar(i, e, t, r) {
7474
7475
  if (i === "true")
7475
7476
  return !0;
7476
7477
  if (i === "false")
@@ -7483,9 +7484,9 @@ function _r(i, e, t, r) {
7483
7484
  return NaN;
7484
7485
  if (i === "-0")
7485
7486
  return r ? 0n : 0;
7486
- let n = Mr.test(i);
7487
- if (n || Tr.test(i)) {
7488
- if (Dr.test(i))
7487
+ let n = Tr.test(i);
7488
+ if (n || Dr.test(i)) {
7489
+ if (Or.test(i))
7489
7490
  throw new N("leading zeroes are not allowed", {
7490
7491
  toml: e,
7491
7492
  ptr: t
@@ -7515,7 +7516,7 @@ function _r(i, e, t, r) {
7515
7516
  });
7516
7517
  return o;
7517
7518
  }
7518
- function Ar(i, e, t) {
7519
+ function Fr(i, e, t) {
7519
7520
  let r = i.slice(e, t), n = r.indexOf("#");
7520
7521
  return n > -1 && (Fe(i, n), r = r.slice(0, n)), [r.trimEnd(), n];
7521
7522
  }
@@ -7527,7 +7528,7 @@ function Ve(i, e, t, r, n) {
7527
7528
  });
7528
7529
  let o = i[e];
7529
7530
  if (o === "[" || o === "{") {
7530
- let [l, c] = o === "[" ? jr(i, e, r, n) : Nr(i, e, r, n);
7531
+ let [l, c] = o === "[" ? kr(i, e, r, n) : jr(i, e, r, n);
7531
7532
  if (t) {
7532
7533
  if (c = ae(i, c), i[c] === ",")
7533
7534
  c++;
@@ -7554,19 +7555,19 @@ function Ve(i, e, t, r, n) {
7554
7555
  }
7555
7556
  return [l, s];
7556
7557
  }
7557
- s = Cr(i, e, ",", t);
7558
- let a = Ar(i, e, s - +(i[s - 1] === ","));
7558
+ s = Pr(i, e, ",", t);
7559
+ let a = Fr(i, e, s - +(i[s - 1] === ","));
7559
7560
  if (!a[0])
7560
7561
  throw new N("incomplete key-value declaration: no value specified", {
7561
7562
  toml: i,
7562
7563
  ptr: e
7563
7564
  });
7564
7565
  return t && a[1] > -1 && (s = ae(i, e + a[1]), s += +(i[s] === ",")), [
7565
- _r(a[0], i, e, n),
7566
+ Ar(a[0], i, e, n),
7566
7567
  s
7567
7568
  ];
7568
7569
  }
7569
- let Fr = /^[a-zA-Z0-9-_]+[ \t]*$/;
7570
+ let Nr = /^[a-zA-Z0-9-_]+[ \t]*$/;
7570
7571
  function Ue(i, e, t = "=") {
7571
7572
  let r = e - 1, n = [], o = i.indexOf(t, e);
7572
7573
  if (o < 0)
@@ -7610,7 +7611,7 @@ function Ue(i, e, t = "=") {
7610
7611
  } else {
7611
7612
  r = i.indexOf(".", e);
7612
7613
  let a = i.slice(e, r < 0 || r > o ? o : r);
7613
- if (!Fr.test(a))
7614
+ if (!Nr.test(a))
7614
7615
  throw new N("only letter, numbers, dashes and underscores are allowed in keys", {
7615
7616
  toml: i,
7616
7617
  ptr: e
@@ -7620,7 +7621,7 @@ function Ue(i, e, t = "=") {
7620
7621
  } while (r + 1 && r < o);
7621
7622
  return [n, ae(i, o + 1, !0, !0)];
7622
7623
  }
7623
- function Nr(i, e, t, r) {
7624
+ function jr(i, e, t, r) {
7624
7625
  let n = {}, o = /* @__PURE__ */ new Set(), s;
7625
7626
  for (e++; (s = i[e++]) !== "}" && s; ) {
7626
7627
  if (s === ",")
@@ -7646,8 +7647,8 @@ function Nr(i, e, t, r) {
7646
7647
  toml: i,
7647
7648
  ptr: e
7648
7649
  });
7649
- let [u, v] = Ve(i, d, "}", t - 1, r);
7650
- o.add(u), l[a] = u, e = v;
7650
+ let [u, w] = Ve(i, d, "}", t - 1, r);
7651
+ o.add(u), l[a] = u, e = w;
7651
7652
  }
7652
7653
  }
7653
7654
  if (!s)
@@ -7657,7 +7658,7 @@ function Nr(i, e, t, r) {
7657
7658
  });
7658
7659
  return [n, e];
7659
7660
  }
7660
- function jr(i, e, t, r) {
7661
+ function kr(i, e, t, r) {
7661
7662
  let n = [], o;
7662
7663
  for (e++; (o = i[e++]) !== "]" && o; ) {
7663
7664
  if (o === ",")
@@ -7771,7 +7772,7 @@ function ve(i) {
7771
7772
  }
7772
7773
  return e;
7773
7774
  }
7774
- function kr(i) {
7775
+ function Ir(i) {
7775
7776
  for (let e = 0; e < i.length; e++)
7776
7777
  if (ve(i[e]) !== "object")
7777
7778
  return !1;
@@ -7795,11 +7796,11 @@ function qe(i, e, t, r) {
7795
7796
  return i.toISOString();
7796
7797
  }
7797
7798
  if (e === "object")
7798
- return Ir(i, t, r);
7799
- if (e === "array")
7800
7799
  return Rr(i, t, r);
7800
+ if (e === "array")
7801
+ return Lr(i, t, r);
7801
7802
  }
7802
- function Ir(i, e, t) {
7803
+ function Rr(i, e, t) {
7803
7804
  let r = Object.keys(i);
7804
7805
  if (r.length === 0)
7805
7806
  return "{}";
@@ -7810,7 +7811,7 @@ function Ir(i, e, t) {
7810
7811
  }
7811
7812
  return n + " }";
7812
7813
  }
7813
- function Rr(i, e, t) {
7814
+ function Lr(i, e, t) {
7814
7815
  if (i.length === 0)
7815
7816
  return "[]";
7816
7817
  let r = "[ ";
@@ -7821,7 +7822,7 @@ function Rr(i, e, t) {
7821
7822
  }
7822
7823
  return r + " ]";
7823
7824
  }
7824
- function Lr(i, e, t, r) {
7825
+ function Wr(i, e, t, r) {
7825
7826
  if (t === 0)
7826
7827
  throw new Error("Could not stringify the object: maximum object depth exceeded");
7827
7828
  let n = "";
@@ -7842,9 +7843,9 @@ function Ze(i, e, t, r, n) {
7842
7843
  if (f === "symbol" || f === "function")
7843
7844
  throw new TypeError(`cannot serialize values of type '${f}'`);
7844
7845
  let d = xt.test(c) ? c : Je(c);
7845
- if (f === "array" && kr(e[c]))
7846
+ if (f === "array" && Ir(e[c]))
7846
7847
  s += (s && `
7847
- `) + Lr(e[c], t ? `${t}.${d}` : d, r - 1, n);
7848
+ `) + Wr(e[c], t ? `${t}.${d}` : d, r - 1, n);
7848
7849
  else if (f === "object") {
7849
7850
  let u = t ? `${t}.${d}` : d;
7850
7851
  s += (s && `
@@ -7866,11 +7867,11 @@ function $t(i, { maxDepth: e = 1e3, numbersAsFloat: t = !1 } = {}) {
7866
7867
  ` ? r + `
7867
7868
  ` : r;
7868
7869
  }
7869
- const Wr = { parse: St, stringify: $t, TomlDate: de, TomlError: N }, Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7870
+ const Hr = { parse: St, stringify: $t, TomlDate: de, TomlError: N }, Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7870
7871
  __proto__: null,
7871
7872
  TomlDate: de,
7872
7873
  TomlError: N,
7873
- default: Wr,
7874
+ default: Hr,
7874
7875
  parse: St,
7875
7876
  stringify: $t
7876
7877
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7878,52 +7879,52 @@ export {
7878
7879
  ye as ArgParser,
7879
7880
  V as ArgParserBase,
7880
7881
  se as ArgParserError,
7881
- sn as ArgParserFuzzyTester,
7882
- pr as ArgParserMcp,
7882
+ ln as ArgParserFuzzyTester,
7883
+ hr as ArgParserMcp,
7883
7884
  Ae as ConfigPlugin,
7884
- Qt as ConfigPluginRegistry,
7885
+ er as ConfigPluginRegistry,
7885
7886
  K as DxtPathResolver,
7886
- Kt as EnvConfigPlugin,
7887
+ Qt as EnvConfigPlugin,
7887
7888
  Ie as FlagInheritance,
7888
- Xt as JsonConfigPlugin,
7889
- cn as Logger,
7889
+ Kt as JsonConfigPlugin,
7890
+ fn as Logger,
7890
7891
  Re as OutputSchemaPatterns,
7891
7892
  g as SimpleChalk,
7892
7893
  Oe as TomlConfigPlugin,
7893
7894
  _e as YamlConfigPlugin,
7894
- Qr as absolutePath,
7895
- tn as autoHelpHandler,
7896
- cr as convertFlagToJsonSchemaProperty,
7897
- nn as convertFlagsToJsonSchema,
7895
+ tn as absolutePath,
7896
+ nn as autoHelpHandler,
7897
+ ur as convertFlagToJsonSchemaProperty,
7898
+ sn as convertFlagsToJsonSchema,
7898
7899
  ct as convertFlagsToZodSchema,
7899
- un as createCliLogger,
7900
- on as createMcpArgParser,
7900
+ dn as createCliLogger,
7901
+ an as createMcpArgParser,
7901
7902
  ge as createMcpErrorResponse,
7902
- fn as createMcpLogger,
7903
+ pn as createMcpLogger,
7903
7904
  He as createMcpSuccessResponse,
7904
7905
  fe as createOutputSchema,
7905
- hr as createTomlPlugin,
7906
- mr as createTomlPluginAsync,
7907
- yr as createYamlPlugin,
7908
- br as createYamlPluginAsync,
7909
- Kr as cwdRelative,
7906
+ mr as createTomlPlugin,
7907
+ gr as createTomlPluginAsync,
7908
+ br as createYamlPlugin,
7909
+ wr as createYamlPluginAsync,
7910
+ en as cwdRelative,
7910
7911
  B as debug,
7911
7912
  Le as detectEntryPoint,
7912
- Zr as enableConfigPlugins,
7913
- Jr as enableOptionalConfigPlugins,
7914
- qr as enableOptionalConfigPluginsAsync,
7915
- Xr as entryRelative,
7916
- ur as extractSimplifiedResponse,
7913
+ Xr as enableConfigPlugins,
7914
+ Zr as enableOptionalConfigPlugins,
7915
+ Yr as enableOptionalConfigPluginsAsync,
7916
+ Qr as entryRelative,
7917
+ fr as extractSimplifiedResponse,
7917
7918
  ut as generateMcpToolsFromArgParser,
7918
- Yr as getEntryPointFromImportMeta,
7919
+ Kr as getEntryPointFromImportMeta,
7919
7920
  De as getJsonSchemaTypeFromFlag,
7920
7921
  ie as globalConfigPluginRegistry,
7921
- rn as isValidMcpToolName,
7922
- en as legacyCwdPath,
7923
- dn as logger,
7922
+ on as isValidMcpToolName,
7923
+ rn as legacyCwdPath,
7924
+ hn as logger,
7924
7925
  ce as resolveLogPath,
7925
7926
  We as sanitizeMcpToolName,
7926
- tr as zodDxtOptionsSchema,
7927
- rr as zodFlagSchema
7927
+ rr as zodDxtOptionsSchema,
7928
+ nr as zodFlagSchema
7928
7929
  };
7929
7930
  //# sourceMappingURL=index.min.mjs.map