@alcyone-labs/arg-parser 2.13.1 → 2.13.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,14 +1,15 @@
1
1
  import * as C from "node:fs";
2
2
  import * as w from "node:path";
3
- import { fileURLToPath as Ct } from "node:url";
4
- import Pt from "dotenv";
5
- import { createRegExp as Xe, anyOf as Ke, oneOrMore as Qe, char as et } from "magic-regexp";
3
+ import { fileURLToPath as Pt } from "node:url";
4
+ import Mt from "dotenv";
5
+ import { createRegExp as Ke, anyOf as Qe, oneOrMore as et, char as tt } from "magic-regexp";
6
6
  import { createMcpLogger as ne } from "@alcyone-labs/simple-mcp-logger";
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";
7
+ import { Logger as dn, createCliLogger as pn, createMcpLogger as hn, logger as mn } from "@alcyone-labs/simple-mcp-logger";
8
+ import { getTsconfig as Tt, createPathsMatcher as Dt } from "get-tsconfig";
9
+ import * as se from "node:os";
9
10
  import { z as x } 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
+ const Ot = "\x1B[0m", _t = "\x1B[1m", At = "\x1B[2m", Ft = "\x1B[4m", Nt = "\x1B[2J\x1B[3J\x1B[H", jt = "\x1B[30m", kt = "\x1B[31m", It = "\x1B[32m", Rt = "\x1B[33m", Lt = "\x1B[34m", Wt = "\x1B[35m", rt = "\x1B[36m", Ht = "\x1B[37m", nt = "\x1B[90m";
12
+ function Ut() {
12
13
  if (typeof globalThis.window < "u" && typeof globalThis.document < "u")
13
14
  return !globalThis.NO_COLOR;
14
15
  if (typeof process < "u") {
@@ -19,25 +20,25 @@ function Ht() {
19
20
  }
20
21
  return !1;
21
22
  }
22
- const mt = Ht();
23
- function Ut(i, ...e) {
24
- return !mt || e.length === 0 ? i : e.join("") + i + Dt;
23
+ const gt = Ut();
24
+ function Bt(i, ...e) {
25
+ return !gt || e.length === 0 ? i : e.join("") + i + Ot;
25
26
  }
26
27
  function Z(i, e, t, r) {
27
28
  Object.defineProperty(i, e, {
28
- get: () => gt([...r, t]),
29
+ get: () => yt([...r, t]),
29
30
  configurable: !0
30
31
  });
31
32
  }
32
- function gt(i) {
33
- const e = ((t) => Ut(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 : "",
33
+ function yt(i) {
34
+ const e = ((t) => Bt(t, ...i));
35
+ return Z(e, "bold", _t, i), Z(e, "dim", At, i), Z(e, "underline", Ft, i), Z(e, "black", jt, i), Z(e, "red", kt, i), Z(e, "green", It, i), Z(e, "yellow", Rt, i), Z(e, "blue", Lt, i), Z(e, "magenta", Wt, i), Z(e, "cyan", rt, i), Z(e, "white", Ht, i), Z(e, "gray", nt, i), Z(e, "grey", nt, i), Z(e, "blueBright", rt, i), Object.defineProperty(e, "clear", {
36
+ get: () => gt ? Nt : "",
36
37
  configurable: !0
37
38
  }), e;
38
39
  }
39
- const y = gt([]), Bt = "\x1B[0m", le = "\x1B[1m", zt = "\x1B[2m", $e = "\x1B[4m", Vt = "\x1B[2J\x1B[3J\x1B[H", Gt = "\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
+ const y = yt([]), zt = "\x1B[0m", ce = "\x1B[1m", Vt = "\x1B[2m", Ee = "\x1B[4m", Gt = "\x1B[2J\x1B[3J\x1B[H", Jt = "\x1B[30m", Ce = "\x1B[31m", Pe = "\x1B[32m", Ie = "\x1B[33m", Me = "\x1B[34m", qt = "\x1B[35m", ot = "\x1B[36m", Zt = "\x1B[37m", st = "\x1B[90m";
41
+ function Yt() {
41
42
  if (typeof globalThis.window < "u" && typeof globalThis.document < "u")
42
43
  return !globalThis.NO_COLOR;
43
44
  if (typeof process < "u") {
@@ -48,25 +49,25 @@ function Zt() {
48
49
  }
49
50
  return !1;
50
51
  }
51
- const yt = Zt(), W = (i) => yt ? (e) => i + e + Bt : (e) => e, Yt = {
52
+ const bt = Yt(), W = (i) => bt ? (e) => i + e + zt : (e) => e, Xt = {
52
53
  // Colors
53
- black: W(Gt),
54
- red: W(Ee),
55
- green: W(Ce),
56
- yellow: W(ke),
57
- blue: W(Pe),
58
- magenta: W(Jt),
59
- cyan: W(nt),
60
- white: W(qt),
61
- gray: W(ot),
62
- grey: W(ot),
54
+ black: W(Jt),
55
+ red: W(Ce),
56
+ green: W(Pe),
57
+ yellow: W(Ie),
58
+ blue: W(Me),
59
+ magenta: W(qt),
60
+ cyan: W(ot),
61
+ white: W(Zt),
62
+ gray: W(st),
63
+ grey: W(st),
63
64
  // alias
64
- blueBright: W(nt),
65
+ blueBright: W(ot),
65
66
  // alias
66
67
  // Modifiers
67
- bold: W(le),
68
- dim: W(zt),
69
- underline: W($e),
68
+ bold: W(ce),
69
+ dim: W(Vt),
70
+ underline: W(Ee),
70
71
  /**
71
72
  * [NON-CHALK EXTENSION] Returns an ANSI escape sequence that clears the screen
72
73
  * and the scrollback buffer (equivalent to CMD+K).
@@ -76,22 +77,22 @@ const yt = Zt(), W = (i) => yt ? (e) => i + e + Bt : (e) => e, Yt = {
76
77
  * process.stdout.write(fast.clear);
77
78
  * ```
78
79
  */
79
- clear: yt ? Vt : "",
80
+ clear: bt ? Gt : "",
80
81
  // Pre-created common combinations for some chaining support
81
- redBold: W(Ee + le),
82
- greenBold: W(Ce + le),
83
- blueBold: W(Pe + le),
84
- yellowBold: W(ke + le),
85
- redUnderline: W(Ee + $e),
86
- greenUnderline: W(Ce + $e),
87
- blueUnderline: W(Pe + $e),
88
- boldRed: W(le + Ee),
89
- boldGreen: W(le + Ce),
90
- boldBlue: W(le + Pe),
91
- boldYellow: W(le + ke)
82
+ redBold: W(Ce + ce),
83
+ greenBold: W(Pe + ce),
84
+ blueBold: W(Me + ce),
85
+ yellowBold: W(Ie + ce),
86
+ redUnderline: W(Ce + Ee),
87
+ greenUnderline: W(Pe + Ee),
88
+ blueUnderline: W(Me + Ee),
89
+ boldRed: W(ce + Ce),
90
+ boldGreen: W(ce + Pe),
91
+ boldBlue: W(ce + Me),
92
+ boldYellow: W(ce + Ie)
92
93
  };
93
- Object.assign((i) => i, Yt);
94
- const me = typeof globalThis.window < "u" && typeof globalThis.document < "u", pe = {
94
+ Object.assign((i) => i, Xt);
95
+ const ge = typeof globalThis.window < "u" && typeof globalThis.document < "u", he = {
95
96
  reset: "",
96
97
  bold: "font-weight: bold;",
97
98
  dim: "opacity: 0.5;",
@@ -105,7 +106,7 @@ const me = typeof globalThis.window < "u" && typeof globalThis.document < "u", p
105
106
  cyan: "color: #00ffff;",
106
107
  white: "color: #ffffff;",
107
108
  gray: "color: #808080;"
108
- }, ue = {
109
+ }, fe = {
109
110
  reset: "\x1B[0m",
110
111
  bold: "\x1B[1m",
111
112
  dim: "\x1B[2m",
@@ -120,8 +121,8 @@ const me = typeof globalThis.window < "u" && typeof globalThis.document < "u", p
120
121
  white: "\x1B[37m",
121
122
  gray: "\x1B[90m"
122
123
  };
123
- function ze() {
124
- if (me)
124
+ function Ve() {
125
+ if (ge)
125
126
  return !globalThis.NO_COLOR;
126
127
  if (typeof process < "u") {
127
128
  if (process.env.NO_COLOR || process.env.MCP_MODE)
@@ -131,19 +132,19 @@ function ze() {
131
132
  }
132
133
  return !1;
133
134
  }
134
- function Me(i, e) {
135
- if (!ze() || i.length === 0)
135
+ function Te(i, e) {
136
+ if (!Ve() || i.length === 0)
136
137
  return [e];
137
138
  const t = i.join(" ");
138
139
  return [`%c${e}`, t];
139
140
  }
140
- function Te(i, e) {
141
- return !ze() || i.length === 0 ? e : i.join("") + e + ue.reset;
141
+ function De(i, e) {
142
+ return !Ve() || i.length === 0 ? e : i.join("") + e + fe.reset;
142
143
  }
143
144
  function Y(i) {
144
- return (e) => me ? Me([pe[i]], e) : Te([ue[i]], e);
145
+ return (e) => ge ? Te([he[i]], e) : De([fe[i]], e);
145
146
  }
146
- const Xt = {
147
+ const Kt = {
147
148
  // Colors
148
149
  black: Y("black"),
149
150
  red: Y("red"),
@@ -174,14 +175,14 @@ const Xt = {
174
175
  * console.log(...browser.clear);
175
176
  * ```
176
177
  */
177
- clear: ze() ? me ? (console.clear(), "") : "\x1B[2J\x1B[3J\x1B[H" : "",
178
+ clear: Ve() ? ge ? (console.clear(), "") : "\x1B[2J\x1B[3J\x1B[H" : "",
178
179
  // Browser-specific combinations (CSS can combine styles)
179
- redBold: (i) => me ? Me([pe.red, pe.bold], i) : Te([ue.red, ue.bold], i),
180
- greenBold: (i) => me ? Me([pe.green, pe.bold], i) : Te([ue.green, ue.bold], i),
181
- blueBold: (i) => me ? Me([pe.blue, pe.bold], i) : Te([ue.blue, ue.bold], i)
180
+ redBold: (i) => ge ? Te([he.red, he.bold], i) : De([fe.red, fe.bold], i),
181
+ greenBold: (i) => ge ? Te([he.green, he.bold], i) : De([fe.green, fe.bold], i),
182
+ blueBold: (i) => ge ? Te([he.blue, he.bold], i) : De([fe.blue, fe.bold], i)
182
183
  };
183
- Object.assign((i) => i, Xt);
184
- class Ae {
184
+ Object.assign((i) => i, Kt);
185
+ class Fe {
185
186
  /**
186
187
  * Check if this plugin supports a given file extension
187
188
  */
@@ -189,7 +190,7 @@ class Ae {
189
190
  return this.supportedExtensions.includes(e.toLowerCase());
190
191
  }
191
192
  }
192
- class Kt extends Ae {
193
+ class Qt extends Fe {
193
194
  constructor() {
194
195
  super(...arguments), this.supportedExtensions = [".json", ".jsonc"], this.name = "json";
195
196
  }
@@ -223,7 +224,7 @@ class Kt extends Ae {
223
224
  return JSON.stringify(s, null, 2);
224
225
  }
225
226
  }
226
- class Qt extends Ae {
227
+ class er extends Fe {
227
228
  constructor() {
228
229
  super(...arguments), this.supportedExtensions = [".env"], this.name = "env";
229
230
  }
@@ -265,9 +266,9 @@ class Qt extends Ae {
265
266
  return typeof e == "function" ? e.name || "custom function" : String(e).toLowerCase();
266
267
  }
267
268
  }
268
- class er {
269
+ class tr {
269
270
  constructor() {
270
- this.plugins = /* @__PURE__ */ new Map(), this.extensionMap = /* @__PURE__ */ new Map(), this.registerPlugin(new Kt()), this.registerPlugin(new Qt());
271
+ this.plugins = /* @__PURE__ */ new Map(), this.extensionMap = /* @__PURE__ */ new Map(), this.registerPlugin(new Qt()), this.registerPlugin(new er());
271
272
  }
272
273
  /**
273
274
  * Register a configuration plugin
@@ -347,31 +348,31 @@ class er {
347
348
  */
348
349
  async autoRegisterOptionalPluginsAsync() {
349
350
  try {
350
- const { createTomlPluginAsync: e } = await Promise.resolve().then(() => yr), t = await e();
351
+ const { createTomlPluginAsync: e } = await Promise.resolve().then(() => br), t = await e();
351
352
  t && this.registerPlugin(t);
352
353
  } catch {
353
354
  }
354
355
  try {
355
- const { createYamlPluginAsync: e } = await Promise.resolve().then(() => vr), t = await e();
356
+ const { createYamlPluginAsync: e } = await Promise.resolve().then(() => Sr), t = await e();
356
357
  t && this.registerPlugin(t);
357
358
  } catch {
358
359
  }
359
360
  }
360
361
  }
361
- const ie = new er();
362
- function Zr() {
363
- ie.autoRegisterOptionalPlugins();
362
+ const ae = new tr();
363
+ function Yr() {
364
+ ae.autoRegisterOptionalPlugins();
364
365
  }
365
- async function Yr() {
366
- await ie.autoRegisterOptionalPluginsAsync();
366
+ async function Xr() {
367
+ await ae.autoRegisterOptionalPluginsAsync();
367
368
  }
368
- function Xr(i) {
369
+ function Kr(i) {
369
370
  for (const e of i)
370
371
  switch (e.toLowerCase()) {
371
372
  case "toml":
372
373
  try {
373
374
  const { createTomlPlugin: t } = require("./TomlConfigPlugin"), r = t();
374
- r && ie.registerPlugin(r);
375
+ r && ae.registerPlugin(r);
375
376
  } catch (t) {
376
377
  console.warn(
377
378
  `Failed to enable TOML plugin: ${t instanceof Error ? t.message : String(t)}`
@@ -381,7 +382,7 @@ function Xr(i) {
381
382
  case "yaml":
382
383
  try {
383
384
  const { createYamlPlugin: t } = require("./YamlConfigPlugin"), r = t();
384
- r && ie.registerPlugin(r);
385
+ r && ae.registerPlugin(r);
385
386
  } catch (t) {
386
387
  console.warn(
387
388
  `Failed to enable YAML plugin: ${t instanceof Error ? t.message : String(t)}`
@@ -392,7 +393,7 @@ function Xr(i) {
392
393
  console.warn(`Unknown config plugin: ${e}`);
393
394
  }
394
395
  }
395
- class tr {
396
+ class rr {
396
397
  constructor(e) {
397
398
  this.argParserInstance = e;
398
399
  }
@@ -443,7 +444,7 @@ class tr {
443
444
  s.push(...u.flags);
444
445
  const a = w.extname(e).toLowerCase();
445
446
  let l;
446
- const c = ie.getPluginByExtension(a);
447
+ const c = ae.getPluginByExtension(a);
447
448
  if (c)
448
449
  l = c.generate({}, s, o.data);
449
450
  else
@@ -485,7 +486,7 @@ class tr {
485
486
  throw new Error(`Configuration file not found: ${e}`);
486
487
  const r = C.readFileSync(e, "utf8"), n = w.extname(e).toLowerCase();
487
488
  let o;
488
- const s = ie.getPluginByExtension(n);
489
+ const s = ae.getPluginByExtension(n);
489
490
  if (s)
490
491
  o = s.parse(r);
491
492
  else
@@ -537,7 +538,7 @@ class tr {
537
538
  * Parses YAML file content (legacy method - now uses plugin system)
538
539
  */
539
540
  parseYamlFile(e) {
540
- const t = ie.getPluginByExtension(".yaml");
541
+ const t = ae.getPluginByExtension(".yaml");
541
542
  if (t)
542
543
  return t.parse(e);
543
544
  console.warn(
@@ -604,7 +605,7 @@ class tr {
604
605
  * Parses TOML file content (legacy method - now uses plugin system)
605
606
  */
606
607
  parseTomlFile(e) {
607
- const t = ie.getPluginByExtension(".toml");
608
+ const t = ae.getPluginByExtension(".toml");
608
609
  if (t)
609
610
  return t.parse(e);
610
611
  console.warn(
@@ -766,7 +767,7 @@ class tr {
766
767
  * Generates YAML file format (legacy method - now uses plugin system)
767
768
  */
768
769
  generateYamlFormat(e, t) {
769
- const r = ie.getPluginByExtension(".yaml");
770
+ const r = ae.getPluginByExtension(".yaml");
770
771
  if (r)
771
772
  return r.generate({}, e, t.data || t);
772
773
  const n = [];
@@ -802,7 +803,7 @@ class tr {
802
803
  * Generates TOML file format (legacy method - now uses plugin system)
803
804
  */
804
805
  generateTomlFormat(e, t) {
805
- const r = ie.getPluginByExtension(".toml");
806
+ const r = ae.getPluginByExtension(".toml");
806
807
  if (r)
807
808
  return r.generate({}, e, t.data || t);
808
809
  const n = [];
@@ -829,32 +830,32 @@ class tr {
829
830
  return typeof e == "string" ? e : typeof e == "function" ? e.name || "function" : "unknown";
830
831
  }
831
832
  }
832
- function Le() {
833
+ function We() {
833
834
  try {
834
835
  return process.argv[1] && C.existsSync(process.argv[1]) ? process.argv[1] : typeof require < "u" && require.main && require.main.filename ? require.main.filename : null;
835
836
  } catch {
836
837
  return null;
837
838
  }
838
839
  }
839
- function Kr(i) {
840
+ function Qr(i) {
840
841
  return i.startsWith("file://") ? decodeURIComponent(i.replace("file://", "")) : i;
841
842
  }
842
- function st(i) {
843
+ function it(i) {
843
844
  return i.trim();
844
845
  }
845
- function ce(i, e) {
846
+ function ue(i, e) {
846
847
  if (typeof i == "string") {
847
848
  const a = K.substituteVariables(
848
849
  i,
849
850
  K.detectContext()
850
- ), l = st(a);
851
+ ), l = it(a);
851
852
  if (w.isAbsolute(l))
852
853
  return l;
853
854
  if (l.startsWith("cwd:")) {
854
855
  const u = l.slice(4);
855
856
  return w.resolve(process.cwd(), u);
856
857
  }
857
- const c = Le() || e;
858
+ const c = We() || e;
858
859
  return c ? w.resolve(w.dirname(c), l) : (console.warn(
859
860
  `Warning: Could not detect entry point for log path resolution. Using process.cwd() as fallback. Path: ${l}`
860
861
  ), w.resolve(process.cwd(), l));
@@ -862,7 +863,7 @@ function ce(i, e) {
862
863
  const { path: t, relativeTo: r = "entry", basePath: n } = i, o = K.substituteVariables(
863
864
  t,
864
865
  K.detectContext()
865
- ), s = st(o);
866
+ ), s = it(o);
866
867
  switch (r) {
867
868
  case "absolute":
868
869
  if (n) {
@@ -879,35 +880,35 @@ function ce(i, e) {
879
880
  return w.resolve(process.cwd(), s);
880
881
  case "entry":
881
882
  default:
882
- const a = Le() || e;
883
+ const a = We() || e;
883
884
  return a ? w.resolve(w.dirname(a), s) : (console.warn(
884
885
  `Warning: Could not detect entry point for log path resolution. Using process.cwd() as fallback. Path: ${s}`
885
886
  ), w.resolve(process.cwd(), s));
886
887
  }
887
888
  }
888
- function Qr(i) {
889
+ function en(i) {
889
890
  return {
890
891
  path: i,
891
892
  relativeTo: "entry"
892
893
  };
893
894
  }
894
- function en(i) {
895
+ function tn(i) {
895
896
  return {
896
897
  path: i,
897
898
  relativeTo: "cwd"
898
899
  };
899
900
  }
900
- function tn(i, e) {
901
+ function rn(i, e) {
901
902
  return {
902
903
  path: i,
903
904
  relativeTo: "absolute",
904
905
  basePath: e
905
906
  };
906
907
  }
907
- function rn(i) {
908
+ function nn(i) {
908
909
  return `cwd:${i}`;
909
910
  }
910
- const Ye = class Ye {
911
+ const Xe = class Xe {
911
912
  /**
912
913
  * Detects the current execution context
913
914
  * @param forceRefresh - Force refresh of cached context
@@ -918,9 +919,9 @@ const Ye = class Ye {
918
919
  return this._cachedContext;
919
920
  const t = {
920
921
  isDxt: this.isDxtEnvironment(),
921
- userHome: void 0,
922
+ userHome: typeof se.homedir == "function" ? se.homedir() : void 0,
922
923
  cwd: typeof process < "u" && typeof process.cwd == "function" ? process.cwd() : void 0
923
- }, r = Le();
924
+ }, r = We();
924
925
  return r && (t.entryDir = w.dirname(r)), t.isDxt && (t.extensionDir = this.detectDxtExtensionDir()), this._cachedContext = t, t;
925
926
  }
926
927
  /**
@@ -992,7 +993,7 @@ const Ye = class Ye {
992
993
  * @returns Path with variables substituted
993
994
  */
994
995
  static substituteVariables(e, t, r) {
995
- const n = () => "/tmp", o = t.userHome || n(), s = {
996
+ const n = () => typeof se.homedir == "function" ? se.homedir() : "/tmp", o = t.userHome || n(), s = {
996
997
  // Standard DXT variables
997
998
  HOME: o,
998
999
  DOCUMENTS: w.join(o, "Documents"),
@@ -1038,7 +1039,7 @@ const Ye = class Ye {
1038
1039
  if (r.isDxt && r.extensionDir)
1039
1040
  return w.join(r.extensionDir, "data", e);
1040
1041
  {
1041
- const n = () => "/tmp", o = process.env.XDG_DATA_HOME || w.join(r.userHome || n(), ".local", "share"), s = this.getAppName(r);
1042
+ const n = () => typeof se.homedir == "function" ? se.homedir() : "/tmp", o = process.env.XDG_DATA_HOME || w.join(r.userHome || n(), ".local", "share"), s = this.getAppName(r);
1042
1043
  return w.join(o, s, e);
1043
1044
  }
1044
1045
  }
@@ -1053,7 +1054,7 @@ const Ye = class Ye {
1053
1054
  if (r.isDxt && r.extensionDir)
1054
1055
  return w.join(r.extensionDir, "temp", e);
1055
1056
  {
1056
- const n = () => "/tmp", o = this.getAppName(r);
1057
+ const n = () => typeof se.tmpdir == "function" ? se.tmpdir() : "/tmp", o = this.getAppName(r);
1057
1058
  return w.join(n(), o, e);
1058
1059
  }
1059
1060
  }
@@ -1068,7 +1069,7 @@ const Ye = class Ye {
1068
1069
  if (r.isDxt && r.extensionDir)
1069
1070
  return w.join(r.extensionDir, "config", e);
1070
1071
  {
1071
- const n = () => "/tmp", o = process.env.XDG_CONFIG_HOME || w.join(r.userHome || n(), ".config"), s = this.getAppName(r);
1072
+ const n = () => typeof se.homedir == "function" ? se.homedir() : "/tmp", o = process.env.XDG_CONFIG_HOME || w.join(r.userHome || n(), ".config"), s = this.getAppName(r);
1072
1073
  return w.join(o, s, e);
1073
1074
  }
1074
1075
  }
@@ -1110,9 +1111,9 @@ const Ye = class Ye {
1110
1111
  this._cachedContext = null;
1111
1112
  }
1112
1113
  };
1113
- Ye._cachedContext = null;
1114
- let K = Ye;
1115
- const Ie = {
1114
+ Xe._cachedContext = null;
1115
+ let K = Xe;
1116
+ const Re = {
1116
1117
  /**
1117
1118
  * No flags are inherited from the parent.
1118
1119
  */
@@ -1127,7 +1128,7 @@ const Ie = {
1127
1128
  * even in bottom-up construction scenarios.
1128
1129
  */
1129
1130
  AllParents: "all-parents"
1130
- }, rr = x.object({
1131
+ }, nr = x.object({
1131
1132
  sensitive: x.boolean().optional().describe(
1132
1133
  "Whether this field should be marked as sensitive in DXT user_config"
1133
1134
  ),
@@ -1145,7 +1146,7 @@ const Ie = {
1145
1146
  {
1146
1147
  message: "Invalid dxtOptions: min/max can only be used with type 'number', and min must be <= max"
1147
1148
  }
1148
- ), nr = x.object({
1149
+ ), or = x.object({
1149
1150
  name: x.string().min(1, "Flag name cannot be empty").describe(
1150
1151
  "The output property name, used as a return key `{name: value}`. Must be unique."
1151
1152
  ),
@@ -1218,7 +1219,7 @@ const Ie = {
1218
1219
  env: x.union([x.string(), x.array(x.string())]).optional().describe(
1219
1220
  "Environment variable(s) to map to this flag. Logic: Fallback (Env -> Flag) and Sync (Flag -> Env). Precedence: Flag > Env > Default."
1220
1221
  ),
1221
- dxtOptions: rr.optional().describe(
1222
+ dxtOptions: nr.optional().describe(
1222
1223
  "DXT-specific configuration options for enhanced DXT manifest generation"
1223
1224
  ),
1224
1225
  dynamicRegister: x.custom((i) => typeof i == "function").optional().describe(
@@ -1234,7 +1235,7 @@ const Ie = {
1234
1235
  const e = { ...i };
1235
1236
  return "default" in e && e.default !== void 0 && !("defaultValue" in e) && (e.defaultValue = e.default), "required" in e && e.required !== void 0 && !("mandatory" in e) && (e.mandatory = e.required), e;
1236
1237
  });
1237
- function De(i) {
1238
+ function Oe(i) {
1238
1239
  if (i && typeof i == "object" && i._def)
1239
1240
  return "object";
1240
1241
  if (typeof i == "function")
@@ -1256,7 +1257,7 @@ function De(i) {
1256
1257
  }
1257
1258
  return "string";
1258
1259
  }
1259
- const Re = {
1260
+ const Le = {
1260
1261
  /**
1261
1262
  * Simple success/error response pattern
1262
1263
  * @example { success: true, message: "Operation completed" }
@@ -1308,10 +1309,10 @@ const Re = {
1308
1309
  command: x.string().optional().describe("The command that was executed")
1309
1310
  })
1310
1311
  };
1311
- function fe(i) {
1312
- return typeof i == "string" && i in Re ? Re[i]() : i && typeof i == "object" && "_def" in i ? i : i && typeof i == "object" ? x.object(i) : Re.successError();
1312
+ function de(i) {
1313
+ return typeof i == "string" && i in Le ? Le[i]() : i && typeof i == "object" && "_def" in i ? i : i && typeof i == "object" ? x.object(i) : Le.successError();
1313
1314
  }
1314
- class it {
1315
+ class at {
1315
1316
  constructor(e, t, r) {
1316
1317
  this.argParserInstance = e, this.extractMcpServerInfo = t, this.handleExit = r;
1317
1318
  }
@@ -1393,7 +1394,7 @@ echo "Mock DXT build script for ${o.name}"`;
1393
1394
  return process.env.NODE_ENV === "test" || process.argv[0]?.includes("vitest") || process.argv[1]?.includes("vitest") || process.argv[1]?.includes("tinypool");
1394
1395
  }
1395
1396
  }
1396
- class or {
1397
+ class sr {
1397
1398
  constructor(e) {
1398
1399
  this.argParserInstance = e;
1399
1400
  }
@@ -1416,8 +1417,8 @@ class or {
1416
1417
  */
1417
1418
  async handleBuildDxtFlag(e, t) {
1418
1419
  try {
1419
- if (it.isTestMode())
1420
- return await new it(
1420
+ if (at.isTestMode())
1421
+ return await new at(
1421
1422
  this.argParserInstance,
1422
1423
  () => this.extractMcpServerInfo(),
1423
1424
  (a, l, c, u) => this._handleExit(a, l, c, u)
@@ -2080,7 +2081,7 @@ export default ${JSON.stringify(p, null, 2)};
2080
2081
  const $ = this.argParserInstance.flags, g = {}, h = [];
2081
2082
  for (const b of $)
2082
2083
  b.name === "help" || b.name.startsWith("s-") || (g[b.name] = {
2083
- type: De(b.type),
2084
+ type: Oe(b.type),
2084
2085
  description: b.description || `${b.name} parameter`
2085
2086
  }, b.enum && (g[b.name].enum = b.enum), b.defaultValue !== void 0 && typeof b.defaultValue != "function" && (g[b.name].default = b.defaultValue), b.mandatory && h.push(b.name));
2086
2087
  c = [
@@ -2325,7 +2326,7 @@ export default ${JSON.stringify(p, null, 2)};
2325
2326
  process.env.DEBUG && console.log(
2326
2327
  ` <${y.gray("module-resolve")}> Resolving '${y.green(e)}' from '${y.gray(t)}'`
2327
2328
  );
2328
- const r = Mt(t);
2329
+ const r = Tt(t);
2329
2330
  if (!r?.config.compilerOptions?.paths)
2330
2331
  process.env.DEBUG && console.log(
2331
2332
  ` <${y.gray("ts-paths")}> No tsconfig or paths found for '${t}'`
@@ -2338,7 +2339,7 @@ export default ${JSON.stringify(p, null, 2)};
2338
2339
  Object.keys(r.config.compilerOptions.paths)
2339
2340
  );
2340
2341
  }
2341
- const s = Tt(r);
2342
+ const s = Dt(r);
2342
2343
  if (!s || typeof s != "function")
2343
2344
  process.env.DEBUG && console.log(
2344
2345
  ` <${y.gray("ts-paths")}> Failed to create paths matcher or matcher is not a function`
@@ -2438,8 +2439,8 @@ export default ${JSON.stringify(p, null, 2)};
2438
2439
  return null;
2439
2440
  }
2440
2441
  }
2441
- const at = ne("MCP Notifications");
2442
- class sr {
2442
+ const lt = ne("MCP Notifications");
2443
+ class ir {
2443
2444
  constructor() {
2444
2445
  this.clients = /* @__PURE__ */ new Map(), this.globalListeners = /* @__PURE__ */ new Set(), this.changeHistory = [], this.maxHistorySize = 100;
2445
2446
  }
@@ -2515,7 +2516,7 @@ class sr {
2515
2516
  try {
2516
2517
  o(n);
2517
2518
  } catch (s) {
2518
- at.error("Error in global change listener:", s);
2519
+ lt.error("Error in global change listener:", s);
2519
2520
  }
2520
2521
  for (const o of this.clients.values())
2521
2522
  o.subscriptions.has(e) && this.sendNotificationToClient(o, e);
@@ -2575,7 +2576,7 @@ class sr {
2575
2576
  {}
2576
2577
  );
2577
2578
  } catch (r) {
2578
- at.error(
2579
+ lt.error(
2579
2580
  `Error sending notification to client ${e.clientId}:`,
2580
2581
  r
2581
2582
  ), this.removeClient(e.clientId);
@@ -2600,8 +2601,8 @@ class sr {
2600
2601
  this.clients.clear(), this.globalListeners.clear(), this.changeHistory = [];
2601
2602
  }
2602
2603
  }
2603
- const ir = ne("MCP Prompts");
2604
- class ar {
2604
+ const ar = ne("MCP Prompts");
2605
+ class lr {
2605
2606
  constructor() {
2606
2607
  this.prompts = /* @__PURE__ */ new Map(), this.changeListeners = /* @__PURE__ */ new Set();
2607
2608
  }
@@ -2701,12 +2702,12 @@ class ar {
2701
2702
  try {
2702
2703
  e();
2703
2704
  } catch (t) {
2704
- ir.error("Error in prompt change listener:", t);
2705
+ ar.error("Error in prompt change listener:", t);
2705
2706
  }
2706
2707
  }
2707
2708
  }
2708
- const lr = ne("MCP Resources");
2709
- class lt {
2709
+ const cr = ne("MCP Resources");
2710
+ class ct {
2710
2711
  constructor(e) {
2711
2712
  const t = e.match(/\{([^}]+)\}/g) || [];
2712
2713
  this.paramNames = t.map((n) => n.slice(1, -1));
@@ -2737,7 +2738,7 @@ class lt {
2737
2738
  return [...this.paramNames];
2738
2739
  }
2739
2740
  }
2740
- class cr {
2741
+ class ur {
2741
2742
  constructor() {
2742
2743
  this.resources = /* @__PURE__ */ new Map(), this.changeListeners = /* @__PURE__ */ new Set();
2743
2744
  }
@@ -2780,7 +2781,7 @@ class cr {
2780
2781
  */
2781
2782
  findResourceForUri(e) {
2782
2783
  for (const t of this.resources.values()) {
2783
- const n = new lt(t.config.uriTemplate).parse(e);
2784
+ const n = new ct(t.config.uriTemplate).parse(e);
2784
2785
  if (n !== null)
2785
2786
  return { config: t.config, params: n };
2786
2787
  }
@@ -2824,7 +2825,7 @@ class cr {
2824
2825
  if (this.resources.has(e.name))
2825
2826
  throw new Error(`Resource with name '${e.name}' already exists`);
2826
2827
  try {
2827
- new lt(e.uriTemplate);
2828
+ new ct(e.uriTemplate);
2828
2829
  } catch (t) {
2829
2830
  throw new Error(
2830
2831
  `Invalid URI template '${e.uriTemplate}': ${t instanceof Error ? t.message : String(t)}`
@@ -2839,60 +2840,60 @@ class cr {
2839
2840
  try {
2840
2841
  e();
2841
2842
  } catch (t) {
2842
- lr.error("Error in resource change listener:", t);
2843
+ cr.error("Error in resource change listener:", t);
2843
2844
  }
2844
2845
  }
2845
2846
  }
2846
- const he = () => {
2847
+ const me = () => {
2847
2848
  try {
2848
2849
  return !!(typeof process < "u" && process.env && process.env.DEBUG);
2849
2850
  } catch {
2850
2851
  return !1;
2851
2852
  }
2852
- }, we = ne("DEBUG"), U = {
2853
+ }, ve = ne("DEBUG"), U = {
2853
2854
  /**
2854
2855
  * Log a debug message to stderr (only when DEBUG=true)
2855
2856
  */
2856
2857
  log: (...i) => {
2857
- if (he()) {
2858
+ if (me()) {
2858
2859
  const [e, ...t] = i;
2859
- we.error(typeof e == "string" ? e : String(e), ...t);
2860
+ ve.error(typeof e == "string" ? e : String(e), ...t);
2860
2861
  }
2861
2862
  },
2862
2863
  /**
2863
2864
  * Log an error debug message to stderr (only when DEBUG=true)
2864
2865
  */
2865
2866
  error: (...i) => {
2866
- if (he()) {
2867
+ if (me()) {
2867
2868
  const [e, ...t] = i;
2868
- we.error(typeof e == "string" ? e : String(e), ...t);
2869
+ ve.error(typeof e == "string" ? e : String(e), ...t);
2869
2870
  }
2870
2871
  },
2871
2872
  /**
2872
2873
  * Log a warning debug message to stderr (only when DEBUG=true)
2873
2874
  */
2874
2875
  warn: (...i) => {
2875
- if (he()) {
2876
+ if (me()) {
2876
2877
  const [e, ...t] = i;
2877
- we.warn(typeof e == "string" ? e : String(e), ...t);
2878
+ ve.warn(typeof e == "string" ? e : String(e), ...t);
2878
2879
  }
2879
2880
  },
2880
2881
  /**
2881
2882
  * Log an info debug message to stderr (only when DEBUG=true)
2882
2883
  */
2883
2884
  info: (...i) => {
2884
- if (he()) {
2885
+ if (me()) {
2885
2886
  const [e, ...t] = i;
2886
- we.info(typeof e == "string" ? e : String(e), ...t);
2887
+ ve.info(typeof e == "string" ? e : String(e), ...t);
2887
2888
  }
2888
2889
  },
2889
2890
  /**
2890
2891
  * Log a debug message with a custom prefix (only when DEBUG=true)
2891
2892
  */
2892
2893
  prefixed: (i, ...e) => {
2893
- if (he()) {
2894
+ if (me()) {
2894
2895
  const [t, ...r] = e;
2895
- we.info(
2896
+ ve.info(
2896
2897
  `[${i}] ${typeof t == "string" ? t : String(t)}`,
2897
2898
  ...r
2898
2899
  );
@@ -2902,17 +2903,17 @@ const he = () => {
2902
2903
  * Check if debug mode is currently enabled
2903
2904
  */
2904
2905
  get enabled() {
2905
- return he();
2906
+ return me();
2906
2907
  }
2907
2908
  };
2908
- class Ve {
2909
+ class Ge {
2909
2910
  #t = /* @__PURE__ */ new Map();
2910
2911
  #o;
2911
2912
  constructor(e = {}, t = []) {
2912
2913
  this.#o = e.throwForDuplicateFlags ?? !1, this.addFlags(t);
2913
2914
  }
2914
2915
  static _safeFlag(e) {
2915
- const t = nr.parse(e);
2916
+ const t = or.parse(e);
2916
2917
  let r;
2917
2918
  const n = t.type;
2918
2919
  if (typeof n == "string")
@@ -2949,7 +2950,7 @@ class Ve {
2949
2950
  };
2950
2951
  }
2951
2952
  addFlag(e) {
2952
- const t = Ve._safeFlag(e);
2953
+ const t = Ge._safeFlag(e);
2953
2954
  if (this.#t.has(t.name)) {
2954
2955
  if (this.#o)
2955
2956
  throw new Error(
@@ -2985,7 +2986,7 @@ class Ve {
2985
2986
  return Array.from(this.#t.values()).map((e) => e.name);
2986
2987
  }
2987
2988
  }
2988
- class se extends Error {
2989
+ class ie extends Error {
2989
2990
  constructor(e, t = []) {
2990
2991
  super(e), this.cmdChain = t, this.name = "ArgParserError", this.commandChain = t;
2991
2992
  }
@@ -3018,9 +3019,9 @@ class G {
3018
3019
  // Track dynamically added flags so we can clean them between parses
3019
3020
  #C = /* @__PURE__ */ new Set();
3020
3021
  // MCP-related managers
3021
- #S = new cr();
3022
- #x = new ar();
3023
- #g = new sr();
3022
+ #S = new ur();
3023
+ #x = new lr();
3024
+ #g = new ir();
3024
3025
  // Working directory management
3025
3026
  /** The effective working directory for this parser instance */
3026
3027
  #c = null;
@@ -3029,7 +3030,7 @@ class G {
3029
3030
  /** Tracks if effective working directory has been resolved */
3030
3031
  #$ = !1;
3031
3032
  constructor(e = {}, t) {
3032
- this.#t = e.appName || "app", e.blankSpaceWidth && !isNaN(Number(e.blankSpaceWidth)) && Number(e.blankSpaceWidth) > 20 && (this.#a.blankSpaceWidth = Number(e.blankSpaceWidth)), e.wrapAtWidth && !isNaN(Number(e.wrapAtWidth)) && Number(e.wrapAtWidth) > 30 && (this.#a.wrapAtWidth = Number(e.wrapAtWidth)), typeof e.extraNewLine == "boolean" && (this.#a.extraNewLine = !!e.extraNewLine), typeof e.mandatoryCharacter == "string" && (this.#a.mandatoryCharacter = e.mandatoryCharacter), typeof e.throwForDuplicateFlags == "boolean" && (this.#b = e.throwForDuplicateFlags), this.#r = new Ve(
3033
+ this.#t = e.appName || "app", e.blankSpaceWidth && !isNaN(Number(e.blankSpaceWidth)) && Number(e.blankSpaceWidth) > 20 && (this.#a.blankSpaceWidth = Number(e.blankSpaceWidth)), e.wrapAtWidth && !isNaN(Number(e.wrapAtWidth)) && Number(e.wrapAtWidth) > 30 && (this.#a.wrapAtWidth = Number(e.wrapAtWidth)), typeof e.extraNewLine == "boolean" && (this.#a.extraNewLine = !!e.extraNewLine), typeof e.mandatoryCharacter == "string" && (this.#a.mandatoryCharacter = e.mandatoryCharacter), typeof e.throwForDuplicateFlags == "boolean" && (this.#b = e.throwForDuplicateFlags), this.#r = new Ge(
3033
3034
  {
3034
3035
  throwForDuplicateFlags: this.#b
3035
3036
  },
@@ -3052,7 +3053,7 @@ class G {
3052
3053
  validate: (n, o) => !0
3053
3054
  // Ensure signature matches Zod schema for .args()
3054
3055
  };
3055
- if (this.#r.addFlag(r), this.#M = new or(this), this.#i = new tr(this), e.subCommands)
3056
+ if (this.#r.addFlag(r), this.#M = new sr(this), this.#i = new rr(this), e.subCommands)
3056
3057
  for (const n of e.subCommands)
3057
3058
  this.addSubCommand(n);
3058
3059
  }
@@ -3133,7 +3134,7 @@ class G {
3133
3134
  if (e.enum && e.enum.length > 0) {
3134
3135
  const s = e.enum.map((a) => typeof a == "string" ? `'${a}'` : a).join(", ");
3135
3136
  if (!e.enum.includes(o))
3136
- throw new se(
3137
+ throw new ie(
3137
3138
  `Invalid value '${o}' for flag '${y.yellow(e.name)}'. Allowed values: ${s}`,
3138
3139
  this.getCommandChain()
3139
3140
  );
@@ -3141,12 +3142,12 @@ class G {
3141
3142
  if (e.validate) {
3142
3143
  const s = e.validate(o, r);
3143
3144
  if (s === !1)
3144
- throw new se(
3145
+ throw new ie(
3145
3146
  `Validation failed for flag '${y.yellow(e.name)}' with value '${o}'`,
3146
3147
  this.getCommandChain()
3147
3148
  );
3148
3149
  if (typeof s == "string")
3149
- throw new se(s, this.getCommandChain());
3150
+ throw new ie(s, this.getCommandChain());
3150
3151
  }
3151
3152
  return e.allowMultiple && !Array.isArray(r[e.name]) && (r[e.name] = []), e.allowMultiple ? r[e.name].push(o) : r[e.name] = o;
3152
3153
  }
@@ -3204,7 +3205,7 @@ class G {
3204
3205
  throw new Error(
3205
3206
  `Parser for subcommand '${e.name}' is not an instance of ArgParserBase. Please provide 'new ArgParserBase(...)' for the 'parser' property of an ISubCommand.`
3206
3207
  );
3207
- if (t.#y = this, t.#n = e.name, !t.#o && this.#o && (t.#o = this.#o), e.description && (t.#l = e.description), t.#m = this.#m, t.#v = this.#v, t.#u === !0 || t.#u === Ie.DirectParentOnly || t.#u === Ie.AllParents) {
3208
+ if (t.#y = this, t.#n = e.name, !t.#o && this.#o && (t.#o = this.#o), e.description && (t.#l = e.description), t.#m = this.#m, t.#v = this.#v, t.#u === !0 || t.#u === Re.DirectParentOnly || t.#u === Re.AllParents) {
3208
3209
  const n = this.#r.flags;
3209
3210
  for (const o of n)
3210
3211
  t.#r.hasFlag(o.name) || t.#r._setProcessedFlagForInheritance(o);
@@ -3219,7 +3220,7 @@ class G {
3219
3220
  for (const [t, r] of e.getSubCommands()) {
3220
3221
  const n = r.parser;
3221
3222
  if (!(n instanceof G)) continue;
3222
- if (n.#u === Ie.AllParents) {
3223
+ if (n.#u === Re.AllParents) {
3223
3224
  const s = e.#r.flags;
3224
3225
  let a = !1;
3225
3226
  for (const l of s)
@@ -3471,7 +3472,7 @@ class G {
3471
3472
  if (this.#$ && this.#c !== this.#f && !l) {
3472
3473
  const p = this.#c || process.cwd(), $ = this.#i.discoverEnvFile(p);
3473
3474
  if ($) {
3474
- console.warn(`Auto-discovered env file: ${$}`), Pt.config({
3475
+ console.warn(`Auto-discovered env file: ${$}`), Mt.config({
3475
3476
  path: $,
3476
3477
  quiet: !0,
3477
3478
  override: !0
@@ -3648,7 +3649,7 @@ Arguments Remaining After Simulation:`)
3648
3649
  }
3649
3650
  }
3650
3651
  if (n.length > 0)
3651
- throw new se(
3652
+ throw new ie(
3652
3653
  `Missing mandatory flags: ${n.map((a) => y.yellow(a.name)).join(", ")}`,
3653
3654
  r
3654
3655
  );
@@ -3727,7 +3728,7 @@ Arguments Remaining After Simulation:`)
3727
3728
  } catch (a) {
3728
3729
  if (this.#p)
3729
3730
  this.#P(
3730
- new se(`Handler error: ${a}`, [])
3731
+ new ie(`Handler error: ${a}`, [])
3731
3732
  );
3732
3733
  else
3733
3734
  throw a;
@@ -3742,7 +3743,7 @@ Arguments Remaining After Simulation:`)
3742
3743
  static isExecutedDirectly(e) {
3743
3744
  try {
3744
3745
  if (e) {
3745
- const t = Ct(e), r = w.resolve(process.argv[1]);
3746
+ const t = Pt(e), r = w.resolve(process.argv[1]);
3746
3747
  return t === r;
3747
3748
  }
3748
3749
  return typeof process < "u" && process.argv && process.argv[1], !1;
@@ -3811,14 +3812,14 @@ Arguments Remaining After Simulation:`)
3811
3812
  } catch (S) {
3812
3813
  if (this.#p)
3813
3814
  this.#P(
3814
- new se(`Handler error: ${S}`, [])
3815
+ new ie(`Handler error: ${S}`, [])
3815
3816
  );
3816
3817
  else
3817
3818
  throw S;
3818
3819
  }
3819
3820
  return f;
3820
3821
  } catch (a) {
3821
- if (a instanceof se)
3822
+ if (a instanceof ie)
3822
3823
  if (this.#p) {
3823
3824
  const l = this.#P(a);
3824
3825
  return this.#m ? {} : l;
@@ -3859,7 +3860,7 @@ Arguments Remaining After Simulation:`)
3859
3860
  if (a === -1 || l === null) {
3860
3861
  if (f < c.length) {
3861
3862
  const E = c[f];
3862
- throw new se(
3863
+ throw new ie(
3863
3864
  `Unknown command: '${y.yellow(E)}'`,
3864
3865
  n
3865
3866
  );
@@ -3892,14 +3893,14 @@ Arguments Remaining After Simulation:`)
3892
3893
  }
3893
3894
  if (f < c.length) {
3894
3895
  const h = c[f];
3895
- throw new se(
3896
+ throw new ie(
3896
3897
  `Unknown command: '${y.yellow(h)}'`,
3897
3898
  n
3898
3899
  );
3899
3900
  }
3900
3901
  const m = t.#s.get(l);
3901
3902
  if (!m || !(m.parser instanceof G))
3902
- throw new se(
3903
+ throw new ie(
3903
3904
  `Internal error: Subcommand '${l}' is misconfigured or its parser is not a valid ArgParser instance.`,
3904
3905
  n
3905
3906
  );
@@ -3930,11 +3931,11 @@ Arguments Remaining After Simulation:`)
3930
3931
  ), f = /* @__PURE__ */ new Set();
3931
3932
  for (const d of n)
3932
3933
  if (d.allowLigature && !d.flagOnly) {
3933
- const m = Xe(
3934
- Ke(
3934
+ const m = Ke(
3935
+ Qe(
3935
3936
  ...d.options.map((S) => `${S}=`)
3936
3937
  ),
3937
- Qe(et).groupedAs("arg")
3938
+ et(tt).groupedAs("arg")
3938
3939
  );
3939
3940
  for (let S = 0; S < e.length; S++) {
3940
3941
  if (f.has(S)) continue;
@@ -3989,11 +3990,11 @@ Arguments Remaining After Simulation:`)
3989
3990
  let s = /* @__PURE__ */ new Set();
3990
3991
  for (const u of r)
3991
3992
  if (u.allowLigature && !u.flagOnly) {
3992
- const f = Xe(
3993
- Ke(
3993
+ const f = Ke(
3994
+ Qe(
3994
3995
  ...u.options.map((d) => `${d}=`)
3995
3996
  ),
3996
- Qe(et).groupedAs("arg")
3997
+ et(tt).groupedAs("arg")
3997
3998
  );
3998
3999
  for (let d = 0; d < e.length; d++) {
3999
4000
  if (s.has(d)) continue;
@@ -4489,7 +4490,7 @@ ${y.dim(`Try '${t} --help' for usage details.`)}`
4489
4490
  U.log("Got MCP server config:", JSON.stringify(n));
4490
4491
  const o = r.logPath || (n?.log && typeof n.log == "object" ? n.log.logToFile : null) || n?.logPath || "./logs/mcp.log";
4491
4492
  U.log("Effective log path:", o);
4492
- const s = ce(o);
4493
+ const s = ue(o);
4493
4494
  U.log("Resolved log path:", s);
4494
4495
  let a;
4495
4496
  U.log("About to import simple-mcp-logger");
@@ -4746,20 +4747,20 @@ ${y.dim(`Try '${t} --help' for usage details.`)}`
4746
4747
  return t;
4747
4748
  }
4748
4749
  }
4749
- const nn = async (i) => {
4750
+ const on = async (i) => {
4750
4751
  i.displayHelp();
4751
4752
  };
4752
- function We(i) {
4753
+ function He(i) {
4753
4754
  if (!i || typeof i != "string")
4754
4755
  throw new Error("Tool name must be a non-empty string");
4755
4756
  let e = i.replace(/[^a-zA-Z0-9_-]/g, "_");
4756
4757
  return (!e || /^_+$/.test(e)) && (e = "tool"), e.length > 64 && (e = e.substring(0, 64)), e;
4757
4758
  }
4758
- function on(i) {
4759
+ function sn(i) {
4759
4760
  return !i || typeof i != "string" ? !1 : /^[a-zA-Z0-9_-]{1,64}$/.test(i);
4760
4761
  }
4761
4762
  const F = ne("MCP Integration");
4762
- function He(i) {
4763
+ function Ue(i) {
4763
4764
  return {
4764
4765
  content: [
4765
4766
  {
@@ -4769,7 +4770,7 @@ function He(i) {
4769
4770
  ]
4770
4771
  };
4771
4772
  }
4772
- function ge(i) {
4773
+ function ye(i) {
4773
4774
  const e = i instanceof Error ? i.message : i, t = { error: e, success: !1 };
4774
4775
  return {
4775
4776
  isError: !0,
@@ -4782,7 +4783,7 @@ function ge(i) {
4782
4783
  structuredContent: t
4783
4784
  };
4784
4785
  }
4785
- function ur(i) {
4786
+ function fr(i) {
4786
4787
  if (i.type && typeof i.type == "object" && i.type._def) {
4787
4788
  const n = i.type;
4788
4789
  try {
@@ -4803,23 +4804,23 @@ function ur(i) {
4803
4804
  }
4804
4805
  }
4805
4806
  const e = {
4806
- type: De(i.type),
4807
+ type: Oe(i.type),
4807
4808
  description: i.description || `${i.name} parameter`
4808
4809
  };
4809
4810
  i.enum && Array.isArray(i.enum) && (e.enum = i.enum);
4810
4811
  const t = i.defaultValue || i.default;
4811
- t !== void 0 ? e.default = t : i.flagOnly && De(i.type) === "boolean" && (e.default = !1), i.type === "array" && i.itemType && (e.items = {
4812
- type: De(i.itemType)
4812
+ t !== void 0 ? e.default = t : i.flagOnly && Oe(i.type) === "boolean" && (e.default = !1), i.type === "array" && i.itemType && (e.items = {
4813
+ type: Oe(i.itemType)
4813
4814
  });
4814
4815
  const r = !!(i.mandatory || i.required);
4815
4816
  return { property: e, isRequired: r };
4816
4817
  }
4817
- function sn(i) {
4818
+ function an(i) {
4818
4819
  const e = {}, t = [];
4819
4820
  for (const r of i) {
4820
4821
  if (r.name === "help" || r.name.startsWith("s-"))
4821
4822
  continue;
4822
- const { property: n, isRequired: o } = ur(r);
4823
+ const { property: n, isRequired: o } = fr(r);
4823
4824
  e[r.name] = n, o && t.push(r.name);
4824
4825
  }
4825
4826
  return {
@@ -4828,17 +4829,17 @@ function sn(i) {
4828
4829
  required: t
4829
4830
  };
4830
4831
  }
4831
- function ct(i) {
4832
+ function ut(i) {
4832
4833
  const e = {};
4833
4834
  for (const t of i) {
4834
4835
  if (t.name === "help" || t.name.startsWith("s-"))
4835
4836
  continue;
4836
- const r = bt(t);
4837
+ const r = wt(t);
4837
4838
  e[t.name] = r;
4838
4839
  }
4839
4840
  return x.object(e);
4840
4841
  }
4841
- function fr(i) {
4842
+ function dr(i) {
4842
4843
  if (typeof i == "object" && i !== null && "success" in i)
4843
4844
  return {
4844
4845
  success: i.success,
@@ -4886,7 +4887,7 @@ function fr(i) {
4886
4887
  exitCode: 1
4887
4888
  };
4888
4889
  }
4889
- function bt(i) {
4890
+ function wt(i) {
4890
4891
  const e = i.type;
4891
4892
  if (e && typeof e == "object" && e._def)
4892
4893
  return e;
@@ -4956,7 +4957,7 @@ function bt(i) {
4956
4957
  const a = i.defaultValue;
4957
4958
  return a !== void 0 ? t = t.default(a) : i.mandatory || (t = t.optional()), t;
4958
4959
  }
4959
- function ut(i, e) {
4960
+ function ft(i, e) {
4960
4961
  const t = [], r = /* @__PURE__ */ new Set();
4961
4962
  function n(o, s) {
4962
4963
  if (r.has(o)) return;
@@ -4966,11 +4967,11 @@ function ut(i, e) {
4966
4967
  !p && o !== i && (p = l.getSubCommandName ? l.getSubCommandName() : l["#subCommandName"]), o !== i && s.length > 0 && (p = s[s.length - 1]);
4967
4968
  const $ = p || c, g = p || (s.length > 0 ? s[s.length - 1] : c);
4968
4969
  let h;
4969
- if (e?.generateToolName ? h = e.generateToolName(s, c) : (o === i ? h = $ || c || "root_cmd" : h = g || "cmd", h = We(h)), h || (h = o === i && c ? c : "cmd"), e?.toolNamePrefix && (h = e.toolNamePrefix + h), e?.toolNameSuffix && (h = h + e.toolNameSuffix), f) {
4970
+ if (e?.generateToolName ? h = e.generateToolName(s, c) : (o === i ? h = $ || c || "root_cmd" : h = g || "cmd", h = He(h)), h || (h = o === i && c ? c : "cmd"), e?.toolNamePrefix && (h = e.toolNamePrefix + h), e?.toolNameSuffix && (h = h + e.toolNameSuffix), f) {
4970
4971
  const b = d, E = {}, D = b.some((M) => M.name === "help");
4971
4972
  for (const M of b) {
4972
4973
  if (M.name === "help") continue;
4973
- let A = bt(M);
4974
+ let A = wt(M);
4974
4975
  D && M.mandatory && (A = A.optional()), E[M.name] = A;
4975
4976
  }
4976
4977
  const P = x.object(E);
@@ -4978,7 +4979,7 @@ function ut(i, e) {
4978
4979
  if (e?.outputSchemaMap && e.outputSchemaMap[h]) {
4979
4980
  const M = e.outputSchemaMap[h];
4980
4981
  T = typeof M == "object" && M !== null && !M._def ? x.object(M) : M;
4981
- } else e?.defaultOutputSchema ? T = e.defaultOutputSchema : e?.autoGenerateOutputSchema && (typeof e.autoGenerateOutputSchema == "string" ? T = fe(e.autoGenerateOutputSchema) : e.autoGenerateOutputSchema === !0 && (T = fe("successWithData")));
4982
+ } else e?.defaultOutputSchema ? T = e.defaultOutputSchema : e?.autoGenerateOutputSchema && (typeof e.autoGenerateOutputSchema == "string" ? T = de(e.autoGenerateOutputSchema) : e.autoGenerateOutputSchema === !0 && (T = de("successWithData")));
4982
4983
  const N = {
4983
4984
  name: h,
4984
4985
  description: u || `Executes the ${h} command.`,
@@ -5216,14 +5217,14 @@ function ut(i, e) {
5216
5217
  structuredContent: J
5217
5218
  };
5218
5219
  }
5219
- return ge(_.message);
5220
+ return ye(_.message);
5220
5221
  }
5221
5222
  let I = R.handlerResponse;
5222
5223
  if (!I && R._asyncHandlerPromise)
5223
5224
  try {
5224
5225
  I = await R._asyncHandlerPromise;
5225
5226
  } catch (O) {
5226
- return ge(
5227
+ return ye(
5227
5228
  O instanceof Error ? O : new Error(String(O))
5228
5229
  );
5229
5230
  }
@@ -5237,9 +5238,9 @@ function ut(i, e) {
5237
5238
  const q = Q;
5238
5239
  delete _.handlerResponse, delete _.$commandChain, delete _.$error, delete _._originalInputArgs, delete _._asyncHandlerPromise, delete _._asyncHandlerInfo, delete _._fuzzyModePreventedExecution, delete _.help;
5239
5240
  for (let B = 0; B < q.length; B++) {
5240
- const z = q[B], Se = O?.getSubCommand ? O.getSubCommand(z) : void 0;
5241
- if (Se && Se.parser)
5242
- J = { ..._ }, _ = { ..._ }, delete _.handlerResponse, delete _.$commandChain, delete _.$error, delete _._originalInputArgs, delete _._asyncHandlerPromise, delete _._asyncHandlerInfo, delete _._fuzzyModePreventedExecution, delete _.help, O = Se.parser;
5241
+ const z = q[B], xe = O?.getSubCommand ? O.getSubCommand(z) : void 0;
5242
+ if (xe && xe.parser)
5243
+ J = { ..._ }, _ = { ..._ }, delete _.handlerResponse, delete _.$commandChain, delete _.$error, delete _._originalInputArgs, delete _._asyncHandlerPromise, delete _._asyncHandlerInfo, delete _._fuzzyModePreventedExecution, delete _.help, O = xe.parser;
5243
5244
  else if (B === 0 && O && z === (O.getAppCommandName ? O.getAppCommandName() : O["#appCommandName"] || (O.getAppName ? O.getAppName() : O["#appName"]))) {
5244
5245
  _ = { ...R }, delete _.handlerResponse, delete _.$commandChain, delete _.$error, delete _._originalInputArgs, delete _._asyncHandlerPromise, delete _._asyncHandlerInfo, delete _._fuzzyModePreventedExecution, delete _.help;
5245
5246
  break;
@@ -5252,25 +5253,25 @@ function ut(i, e) {
5252
5253
  if (O && re) {
5253
5254
  const B = re, z = { ...M };
5254
5255
  delete z.help;
5255
- const Et = {
5256
+ const Ct = {
5256
5257
  args: z,
5257
5258
  commandChain: q,
5258
5259
  parser: O,
5259
5260
  parentArgs: J,
5260
5261
  isMcp: !0,
5261
- getFlag: (be) => {
5262
- if (z && z[be] !== void 0)
5263
- return z[be];
5262
+ getFlag: (we) => {
5263
+ if (z && z[we] !== void 0)
5264
+ return z[we];
5264
5265
  if (O) {
5265
- const Ne = O.getFlagDefinition(be);
5266
- if (Ne) {
5267
- const xe = Ne.env;
5268
- if (xe) {
5269
- const je = Array.isArray(xe) ? xe[0] : xe;
5270
- if (je && process.env[je])
5271
- return process.env[je];
5266
+ const je = O.getFlagDefinition(we);
5267
+ if (je) {
5268
+ const $e = je.env;
5269
+ if ($e) {
5270
+ const ke = Array.isArray($e) ? $e[0] : $e;
5271
+ if (ke && process.env[ke])
5272
+ return process.env[ke];
5272
5273
  }
5273
- return Ne.defaultValue;
5274
+ return je.defaultValue;
5274
5275
  }
5275
5276
  }
5276
5277
  },
@@ -5280,9 +5281,9 @@ function ut(i, e) {
5280
5281
  logger: F
5281
5282
  };
5282
5283
  try {
5283
- I = await B(Et);
5284
- } catch (be) {
5285
- return ge(be);
5284
+ I = await B(Ct);
5285
+ } catch (we) {
5286
+ return ye(we);
5286
5287
  }
5287
5288
  }
5288
5289
  }
@@ -5347,7 +5348,7 @@ function ut(i, e) {
5347
5348
  }
5348
5349
  return process.env.MCP_DEBUG && F.error(
5349
5350
  `[MCP Execute] Returning success response for '${h}'`
5350
- ), He(ee);
5351
+ ), Ue(ee);
5351
5352
  } catch (L) {
5352
5353
  process.env.MCP_DEBUG && F.error(
5353
5354
  `[MCP Execute] Exception caught in tool '${h}':`,
@@ -5413,13 +5414,13 @@ function ut(i, e) {
5413
5414
  structuredContent: k
5414
5415
  };
5415
5416
  }
5416
- return ge(H);
5417
+ return ye(H);
5417
5418
  }
5418
5419
  },
5419
5420
  async executeForTesting(M) {
5420
5421
  try {
5421
5422
  const A = await this.execute(M);
5422
- return fr(A);
5423
+ return dr(A);
5423
5424
  } catch (A) {
5424
5425
  return {
5425
5426
  success: !1,
@@ -5445,15 +5446,15 @@ function ut(i, e) {
5445
5446
  }
5446
5447
  return n(i, []), t;
5447
5448
  }
5448
- const dr = "2025-06-18";
5449
- function pr(i, e) {
5449
+ const pr = "2025-06-18";
5450
+ function hr(i, e) {
5450
5451
  return i === e ? 0 : i < e ? -1 : 1;
5451
5452
  }
5452
5453
  const X = ne("Zod Compatibility");
5453
- function ft(i, e = "Schema") {
5454
+ function dt(i, e = "Schema") {
5454
5455
  process.env.MCP_DEBUG && (X.error(`[Zod Compatibility Debug] ${e} structure:`), X.error(` - Type: ${typeof i}`), X.error(` - Constructor: ${i?.constructor?.name}`), X.error(` - Has shape: ${!!i?.shape}`), X.error(` - Has _def: ${!!i?._def}`), X.error(` - _def.typeName: ${i?._def?.typeName}`), X.error(` - _def.type: ${i?._def?.type}`), X.error(` - Has parse: ${typeof i?.parse}`), X.error(` - Has safeParse: ${typeof i?.safeParse}`), i?.shape && X.error(` - Shape keys: ${Object.keys(i.shape)}`));
5455
5456
  }
5456
- function dt(i) {
5457
+ function pt(i) {
5457
5458
  try {
5458
5459
  return typeof i?.parse != "function" ? (X.warn("[Zod Compatibility] Schema missing parse method"), !1) : typeof i?.safeParse != "function" ? (X.warn("[Zod Compatibility] Schema missing safeParse method"), !1) : (i?._def?.typeName === "ZodObject" || i?._def?.type === "object") && !i?.shape ? (X.warn(
5459
5460
  "[Zod Compatibility] ZodObject schema missing shape property"
@@ -5465,9 +5466,9 @@ function dt(i) {
5465
5466
  ), !1;
5466
5467
  }
5467
5468
  }
5468
- class ye extends G {
5469
+ class be extends G {
5469
5470
  constructor() {
5470
- super(...arguments), this._mcpTools = /* @__PURE__ */ new Map(), this._tools = /* @__PURE__ */ new Map(), this._outputSchemaMap = /* @__PURE__ */ new Map(), this._mcpProtocolVersion = dr;
5471
+ super(...arguments), this._mcpTools = /* @__PURE__ */ new Map(), this._tools = /* @__PURE__ */ new Map(), this._outputSchemaMap = /* @__PURE__ */ new Map(), this._mcpProtocolVersion = pr;
5471
5472
  }
5472
5473
  /**
5473
5474
  * Get the stored MCP server configuration
@@ -5486,7 +5487,7 @@ class ye extends G {
5486
5487
  if (e)
5487
5488
  return {
5488
5489
  prefix: "MCP Server Creation",
5489
- logToFile: ce(e),
5490
+ logToFile: ue(e),
5490
5491
  level: "error",
5491
5492
  // Default level for backward compatibility
5492
5493
  mcpMode: !0
@@ -5499,18 +5500,18 @@ class ye extends G {
5499
5500
  // Default level for backward compatibility
5500
5501
  mcpMode: !0
5501
5502
  };
5502
- return r && t.log && (typeof t.log == "string" ? s.logToFile = ce(t.log) : s = {
5503
+ return r && t.log && (typeof t.log == "string" ? s.logToFile = ue(t.log) : s = {
5503
5504
  ...s,
5504
5505
  ...t.log,
5505
5506
  // Resolve logToFile path if provided in log config
5506
5507
  ...t.log.logToFile && {
5507
- logToFile: ce(t.log.logToFile)
5508
+ logToFile: ue(t.log.logToFile)
5508
5509
  }
5509
- }), n && t.logPath && !s.logToFile && (s.logToFile = ce(t.logPath)), n && t.logPath && r && t.log && typeof t.log == "object" && t.log.logToFile && (s.logToFile = ce(t.logPath)), s;
5510
+ }), n && t.logPath && !s.logToFile && (s.logToFile = ue(t.logPath)), n && t.logPath && r && t.log && typeof t.log == "object" && t.log.logToFile && (s.logToFile = ue(t.logPath)), s;
5510
5511
  }
5511
5512
  return {
5512
5513
  prefix: "MCP Server Creation",
5513
- logToFile: ce("./logs/mcp.log"),
5514
+ logToFile: ue("./logs/mcp.log"),
5514
5515
  level: "error",
5515
5516
  // Default level for backward compatibility
5516
5517
  mcpMode: !0
@@ -5522,7 +5523,7 @@ class ye extends G {
5522
5523
  * @returns This ArgParser instance for chaining
5523
5524
  */
5524
5525
  setDefaultOutputSchema(e) {
5525
- return this._defaultOutputSchema = fe(e), this;
5526
+ return this._defaultOutputSchema = de(e), this;
5526
5527
  }
5527
5528
  /**
5528
5529
  * Set an output schema for a specific tool/command
@@ -5531,7 +5532,7 @@ class ye extends G {
5531
5532
  * @returns This ArgParser instance for chaining
5532
5533
  */
5533
5534
  setOutputSchema(e, t) {
5534
- return this._outputSchemaMap.set(e, fe(t)), this;
5535
+ return this._outputSchemaMap.set(e, de(t)), this;
5535
5536
  }
5536
5537
  /**
5537
5538
  * Enable automatic output schema generation for MCP tools
@@ -5555,7 +5556,7 @@ class ye extends G {
5555
5556
  * @returns true if output schemas are supported
5556
5557
  */
5557
5558
  supportsOutputSchemas() {
5558
- return pr(this._mcpProtocolVersion, "2025-06-18") >= 0;
5559
+ return hr(this._mcpProtocolVersion, "2025-06-18") >= 0;
5559
5560
  }
5560
5561
  /**
5561
5562
  * Add a unified tool that works in both CLI and MCP modes
@@ -5570,7 +5571,7 @@ class ye extends G {
5570
5571
  throw new Error("Tool name is required and must be a string");
5571
5572
  if (!e.handler || typeof e.handler != "function")
5572
5573
  throw new Error("Tool handler is required and must be a function");
5573
- const t = We(e.name);
5574
+ const t = He(e.name);
5574
5575
  if (t !== e.name && console.warn(
5575
5576
  `[ArgParser] Tool name '${e.name}' was sanitized to '${t}' for MCP compatibility`
5576
5577
  ), this._tools.has(t))
@@ -5613,7 +5614,7 @@ class ye extends G {
5613
5614
  console.warn(`[DEPRECATED] addMcpTool() is deprecated and will be removed in v2.0.
5614
5615
  Please use addTool() instead for a unified CLI/MCP experience.
5615
5616
  Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-MIGRATION.md`);
5616
- const t = We(e.name);
5617
+ const t = He(e.name);
5617
5618
  if (t !== e.name && console.warn(
5618
5619
  `[ArgParser] Tool name '${e.name}' was sanitized to '${t}' for MCP compatibility`
5619
5620
  ), this._mcpTools.has(t))
@@ -5645,7 +5646,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5645
5646
  * @returns Object with tool counts and names for debugging
5646
5647
  */
5647
5648
  getToolInfo(e) {
5648
- const t = ut(this, e), r = Array.from(this._tools.keys()), n = Array.from(this._mcpTools.keys()), o = t.map((c) => c.name), s = [
5649
+ const t = ft(this, e), r = Array.from(this._tools.keys()), n = Array.from(this._mcpTools.keys()), o = t.map((c) => c.name), s = [
5649
5650
  ...r,
5650
5651
  ...n,
5651
5652
  ...o
@@ -5743,7 +5744,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5743
5744
  defaultOutputSchema: e?.defaultOutputSchema || this._defaultOutputSchema,
5744
5745
  // Use instance auto-generate setting if not specified in options
5745
5746
  autoGenerateOutputSchema: e?.autoGenerateOutputSchema ?? this._autoGenerateOutputSchema
5746
- }, r = ut(this, t), n = Array.from(
5747
+ }, r = ft(this, t), n = Array.from(
5747
5748
  this._tools.values()
5748
5749
  ).map((l) => {
5749
5750
  let c;
@@ -5753,17 +5754,17 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5753
5754
  ), this.logger.error(
5754
5755
  "[MCP Debug] outputSchema has _def:",
5755
5756
  !!(l.outputSchema && typeof l.outputSchema == "object" && "_def" in l.outputSchema)
5756
- )), c = fe(l.outputSchema), process.env.MCP_DEBUG && this.logger.error(
5757
+ )), c = de(l.outputSchema), process.env.MCP_DEBUG && this.logger.error(
5757
5758
  `[MCP Debug] Created output schema for '${l.name}':`,
5758
5759
  !!c
5759
- )) : t.defaultOutputSchema ? c = t.defaultOutputSchema : t.autoGenerateOutputSchema && (typeof t.autoGenerateOutputSchema == "string" ? c = fe(
5760
+ )) : t.defaultOutputSchema ? c = t.defaultOutputSchema : t.autoGenerateOutputSchema && (typeof t.autoGenerateOutputSchema == "string" ? c = de(
5760
5761
  t.autoGenerateOutputSchema
5761
- ) : t.autoGenerateOutputSchema === !0 && (c = fe("successWithData"))), c && !this.supportsOutputSchemas() && (process.env.MCP_DEBUG && this.logger.error(
5762
+ ) : t.autoGenerateOutputSchema === !0 && (c = de("successWithData"))), c && !this.supportsOutputSchemas() && (process.env.MCP_DEBUG && this.logger.error(
5762
5763
  `[MCP Debug] Output schema for '${l.name}' removed due to MCP version ${this._mcpProtocolVersion} not supporting output schemas`
5763
5764
  ), c = void 0), {
5764
5765
  name: l.name,
5765
5766
  description: l.description || `Executes the ${l.name} tool.`,
5766
- inputSchema: ct(l.flags),
5767
+ inputSchema: ut(l.flags),
5767
5768
  outputSchema: c,
5768
5769
  execute: async (u) => {
5769
5770
  const f = globalThis.console;
@@ -5805,10 +5806,10 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5805
5806
  }
5806
5807
  ],
5807
5808
  structuredContent: p
5808
- } : He(p);
5809
+ } : Ue(p);
5809
5810
  } catch (m) {
5810
5811
  const S = `Tool '${l.name}' execution failed: ${m instanceof Error ? m.message : String(m)}`;
5811
- return process.env.MCP_DEBUG && (this.logger.error(`[MCP Tool Error] ${S}`), m instanceof Error && m.stack && this.logger.error(`[MCP Tool Stack] ${m.stack}`)), ge(S);
5812
+ return process.env.MCP_DEBUG && (this.logger.error(`[MCP Tool Error] ${S}`), m instanceof Error && m.stack && this.logger.error(`[MCP Tool Stack] ${m.stack}`)), ye(S);
5812
5813
  } finally {
5813
5814
  globalThis.console = f;
5814
5815
  }
@@ -5834,10 +5835,10 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5834
5835
  }
5835
5836
  ],
5836
5837
  structuredContent: f
5837
- } : He(f);
5838
+ } : Ue(f);
5838
5839
  } catch (u) {
5839
5840
  const f = `Tool '${l.name}' execution failed: ${u instanceof Error ? u.message : String(u)}`;
5840
- return process.env.MCP_DEBUG && this.logger.error(`[MCP Tool Error] ${f}`), ge(f);
5841
+ return process.env.MCP_DEBUG && this.logger.error(`[MCP Tool Error] ${f}`), ye(f);
5841
5842
  }
5842
5843
  }
5843
5844
  }));
@@ -5886,7 +5887,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5886
5887
  o.mcpError("Successfully created McpServer instance");
5887
5888
  const u = process.argv.includes("--s-mcp-serve");
5888
5889
  if (this._mcpServerConfig?.lifecycle && !u) {
5889
- const { McpLifecycleManager: p } = await Promise.resolve().then(() => xr), $ = new p(
5890
+ const { McpLifecycleManager: p } = await Promise.resolve().then(() => $r), $ = new p(
5890
5891
  this._mcpServerConfig.lifecycle,
5891
5892
  o,
5892
5893
  s,
@@ -5952,7 +5953,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5952
5953
  ), h = Array.from(this._mcpTools.values()).find(
5953
5954
  (D) => D.name === p.name
5954
5955
  );
5955
- g && g.flags ? $ = ct(g.flags) : h && h.inputSchema ? $ = h.inputSchema : $ = x.object({});
5956
+ g && g.flags ? $ = ut(g.flags) : h && h.inputSchema ? $ = h.inputSchema : $ = x.object({});
5956
5957
  let v;
5957
5958
  try {
5958
5959
  process.env.MCP_DEBUG && (this.logger.error(
@@ -5986,7 +5987,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
5986
5987
  ), this.logger.error("[MCP Debug] zodSchema type:", typeof $), this.logger.error("[MCP Debug] zodSchema:", $), this.logger.error(
5987
5988
  "[MCP Debug] zodSchema constructor:",
5988
5989
  $?.constructor?.name
5989
- )), ft(v, `Tool ${p.name} schema`), dt(v) || o.mcpError(
5990
+ )), dt(v, `Tool ${p.name} schema`), pt(v) || o.mcpError(
5990
5991
  `Warning: Schema for tool ${p.name} may not be fully compatible with MCP SDK`
5991
5992
  );
5992
5993
  const b = {
@@ -6025,7 +6026,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6025
6026
  inputSchema: v
6026
6027
  }
6027
6028
  )), p.outputSchema && this.supportsOutputSchemas()) {
6028
- const D = fe(p.outputSchema);
6029
+ const D = de(p.outputSchema);
6029
6030
  b.outputSchema = D, process.env.MCP_DEBUG && (this.logger.error(
6030
6031
  `[MCP Debug] Including outputSchema for tool '${p.name}':`,
6031
6032
  typeof p.outputSchema
@@ -6166,11 +6167,11 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6166
6167
  v
6167
6168
  ), v;
6168
6169
  }
6169
- if (!dt($))
6170
+ if (!pt($))
6170
6171
  throw new Error(
6171
6172
  `Schema validation failed for prompt ${p.name}`
6172
6173
  );
6173
- process.env.MCP_DEBUG && ft($, `prompt ${p.name}`);
6174
+ process.env.MCP_DEBUG && dt($, `prompt ${p.name}`);
6174
6175
  const g = {
6175
6176
  title: p.title || p.name,
6176
6177
  // MCP SDK requires title field
@@ -6292,7 +6293,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6292
6293
  * Private helper method to start a single transport
6293
6294
  */
6294
6295
  async #n(e, t, r, n) {
6295
- const o = ce(n || "./logs/mcp.log"), s = ne("MCP Transport", o);
6296
+ const o = ue(n || "./logs/mcp.log"), s = ne("MCP Transport", o);
6296
6297
  try {
6297
6298
  switch (s.mcpError(
6298
6299
  `Starting ${r.type} transport for server: ${t.name}`
@@ -6624,7 +6625,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6624
6625
  const { mcp: r, ...n } = e || {}, o = {
6625
6626
  handleErrors: !1,
6626
6627
  ...n
6627
- }, s = new ye(o, t);
6628
+ }, s = new be(o, t);
6628
6629
  return r && (s._mcpServerConfig = r), s;
6629
6630
  }
6630
6631
  /**
@@ -6637,7 +6638,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6637
6638
  handleErrors: !0,
6638
6639
  ...e
6639
6640
  };
6640
- return new ye(r, t);
6641
+ return new be(r, t);
6641
6642
  }
6642
6643
  /**
6643
6644
  * Create an ArgParser instance optimized for library usage
@@ -6649,10 +6650,10 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6649
6650
  handleErrors: !1,
6650
6651
  ...e
6651
6652
  };
6652
- return new ye(r, t);
6653
+ return new be(r, t);
6653
6654
  }
6654
6655
  static fromArgParser(e) {
6655
- const t = e, r = new ye({
6656
+ const t = e, r = new be({
6656
6657
  appName: t.getAppName(),
6657
6658
  appCommandName: t.getAppCommandName(),
6658
6659
  description: t.getDescription(),
@@ -6667,7 +6668,7 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6667
6668
  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;
6668
6669
  }
6669
6670
  }
6670
- class hr extends ye {
6671
+ class mr extends be {
6671
6672
  constructor(e, t) {
6672
6673
  const r = {
6673
6674
  ...e,
@@ -6686,10 +6687,10 @@ class hr extends ye {
6686
6687
  return super.parse(r, t);
6687
6688
  }
6688
6689
  }
6689
- function an(i, e) {
6690
- return hr.withMcp(i, e);
6690
+ function ln(i, e) {
6691
+ return mr.withMcp(i, e);
6691
6692
  }
6692
- class Oe extends Ae {
6693
+ class _e extends Fe {
6693
6694
  constructor(e) {
6694
6695
  super(), this.supportedExtensions = [".toml", ".tml"], this.name = "toml", this.tomlModule = null, e ? this.tomlModule = e : this.loadTomlModule();
6695
6696
  }
@@ -6768,9 +6769,9 @@ class Oe extends Ae {
6768
6769
  return typeof e == "function" ? e.name || "custom function" : String(e).toLowerCase();
6769
6770
  }
6770
6771
  }
6771
- function mr() {
6772
+ function gr() {
6772
6773
  try {
6773
- return new Oe();
6774
+ return new _e();
6774
6775
  } catch (i) {
6775
6776
  return console.warn(
6776
6777
  "TOML plugin not available:",
@@ -6778,16 +6779,16 @@ function mr() {
6778
6779
  ), null;
6779
6780
  }
6780
6781
  }
6781
- async function gr() {
6782
+ async function yr() {
6782
6783
  try {
6783
6784
  if (typeof require < "u")
6784
6785
  try {
6785
6786
  const e = require("smol-toml");
6786
- return new Oe(e);
6787
+ return new _e(e);
6787
6788
  } catch {
6788
6789
  }
6789
- const i = await Promise.resolve().then(() => Ur);
6790
- return new Oe(i);
6790
+ const i = await Promise.resolve().then(() => Br);
6791
+ return new _e(i);
6791
6792
  } catch (i) {
6792
6793
  return console.warn(
6793
6794
  "TOML plugin not available:",
@@ -6795,13 +6796,13 @@ async function gr() {
6795
6796
  ), null;
6796
6797
  }
6797
6798
  }
6798
- const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6799
+ const br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6799
6800
  __proto__: null,
6800
- TomlConfigPlugin: Oe,
6801
- createTomlPlugin: mr,
6802
- createTomlPluginAsync: gr
6801
+ TomlConfigPlugin: _e,
6802
+ createTomlPlugin: gr,
6803
+ createTomlPluginAsync: yr
6803
6804
  }, Symbol.toStringTag, { value: "Module" }));
6804
- class _e extends Ae {
6805
+ class Ae extends Fe {
6805
6806
  constructor(e) {
6806
6807
  super(), this.supportedExtensions = [".yaml", ".yml"], this.name = "yaml", this.yamlModule = null, e ? this.yamlModule = e : this.loadYamlModule();
6807
6808
  }
@@ -6881,9 +6882,9 @@ class _e extends Ae {
6881
6882
  return t;
6882
6883
  }
6883
6884
  }
6884
- function br() {
6885
+ function wr() {
6885
6886
  try {
6886
- return new _e();
6887
+ return new Ae();
6887
6888
  } catch (i) {
6888
6889
  return console.warn(
6889
6890
  "YAML plugin not available:",
@@ -6891,16 +6892,16 @@ function br() {
6891
6892
  ), null;
6892
6893
  }
6893
6894
  }
6894
- async function wr() {
6895
+ async function vr() {
6895
6896
  try {
6896
6897
  if (typeof require < "u")
6897
6898
  try {
6898
6899
  const e = require("js-yaml");
6899
- return new _e(e);
6900
+ return new Ae(e);
6900
6901
  } catch {
6901
6902
  }
6902
6903
  const i = await import("js-yaml");
6903
- return new _e(i);
6904
+ return new Ae(i);
6904
6905
  } catch (i) {
6905
6906
  return console.warn(
6906
6907
  "YAML plugin not available:",
@@ -6908,13 +6909,13 @@ async function wr() {
6908
6909
  ), null;
6909
6910
  }
6910
6911
  }
6911
- const vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6912
+ const Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6912
6913
  __proto__: null,
6913
- YamlConfigPlugin: _e,
6914
- createYamlPlugin: br,
6915
- createYamlPluginAsync: wr
6914
+ YamlConfigPlugin: Ae,
6915
+ createYamlPlugin: wr,
6916
+ createYamlPluginAsync: vr
6916
6917
  }, Symbol.toStringTag, { value: "Module" }));
6917
- class ln {
6918
+ class cn {
6918
6919
  constructor(e, t = {}) {
6919
6920
  this.parser = e, this.options = {
6920
6921
  maxDepth: t.maxDepth ?? 5,
@@ -7174,7 +7175,7 @@ class ln {
7174
7175
  };
7175
7176
  }
7176
7177
  }
7177
- class Sr {
7178
+ class xr {
7178
7179
  constructor(e, t, r, n) {
7179
7180
  this.events = e, this.logger = t, this.serverInfo = r, this.argParser = n, this.state = {
7180
7181
  initialized: !1,
@@ -7289,15 +7290,15 @@ class Sr {
7289
7290
  return this.state.ready && !this.state.shuttingDown;
7290
7291
  }
7291
7292
  }
7292
- const xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7293
+ const $r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7293
7294
  __proto__: null,
7294
- McpLifecycleManager: Sr
7295
+ McpLifecycleManager: xr
7295
7296
  }, Symbol.toStringTag, { value: "Module" }));
7296
- function $r(i, e) {
7297
+ function Er(i, e) {
7297
7298
  let t = i.slice(0, e).split(/\r\n|\n|\r/g);
7298
7299
  return [t.length, t.pop().length + 1];
7299
7300
  }
7300
- function Er(i, e, t) {
7301
+ function Cr(i, e, t) {
7301
7302
  let r = i.split(/\r\n|\n|\r/g), n = "", o = (Math.log10(e + 1) | 0) + 1;
7302
7303
  for (let s = e - 1; s <= e + 1; s++) {
7303
7304
  let a = r[s - 1];
@@ -7312,24 +7313,24 @@ class j extends Error {
7312
7313
  column;
7313
7314
  codeblock;
7314
7315
  constructor(e, t) {
7315
- const [r, n] = $r(t.toml, t.ptr), o = Er(t.toml, r, n);
7316
+ const [r, n] = Er(t.toml, t.ptr), o = Cr(t.toml, r, n);
7316
7317
  super(`Invalid TOML document: ${e}
7317
7318
 
7318
7319
  ${o}`, t), this.line = r, this.column = n, this.codeblock = o;
7319
7320
  }
7320
7321
  }
7321
- function Cr(i, e) {
7322
+ function Pr(i, e) {
7322
7323
  let t = 0;
7323
7324
  for (; i[e - ++t] === "\\"; )
7324
7325
  ;
7325
7326
  return --t && t % 2;
7326
7327
  }
7327
- function Ue(i, e = 0, t = i.length) {
7328
+ function Be(i, e = 0, t = i.length) {
7328
7329
  let r = i.indexOf(`
7329
7330
  `, e);
7330
7331
  return i[r - 1] === "\r" && r--, r <= t ? r : -1;
7331
7332
  }
7332
- function Fe(i, e) {
7333
+ function Ne(i, e) {
7333
7334
  for (let t = e; t < i.length; t++) {
7334
7335
  let r = i[t];
7335
7336
  if (r === `
@@ -7346,21 +7347,21 @@ function Fe(i, e) {
7346
7347
  }
7347
7348
  return i.length;
7348
7349
  }
7349
- function ae(i, e, t, r) {
7350
+ function le(i, e, t, r) {
7350
7351
  let n;
7351
7352
  for (; (n = i[e]) === " " || n === " " || !t && (n === `
7352
7353
  ` || n === "\r" && i[e + 1] === `
7353
7354
  `); )
7354
7355
  e++;
7355
- return r || n !== "#" ? e : ae(i, Fe(i, e), t);
7356
+ return r || n !== "#" ? e : le(i, Ne(i, e), t);
7356
7357
  }
7357
- function Pr(i, e, t, r, n = !1) {
7358
+ function Mr(i, e, t, r, n = !1) {
7358
7359
  if (!r)
7359
- return e = Ue(i, e), e < 0 ? i.length : e;
7360
+ return e = Be(i, e), e < 0 ? i.length : e;
7360
7361
  for (let o = e; o < i.length; o++) {
7361
7362
  let s = i[o];
7362
7363
  if (s === "#")
7363
- o = Ue(i, o);
7364
+ o = Be(i, o);
7364
7365
  else {
7365
7366
  if (s === t)
7366
7367
  return o + 1;
@@ -7375,23 +7376,23 @@ function Pr(i, e, t, r, n = !1) {
7375
7376
  ptr: e
7376
7377
  });
7377
7378
  }
7378
- function wt(i, e) {
7379
+ function vt(i, e) {
7379
7380
  let t = i[e], r = t === i[e + 1] && i[e + 1] === i[e + 2] ? i.slice(e, e + 3) : t;
7380
7381
  e += r.length - 1;
7381
7382
  do
7382
7383
  e = i.indexOf(r, ++e);
7383
- while (e > -1 && t !== "'" && Cr(i, e));
7384
+ while (e > -1 && t !== "'" && Pr(i, e));
7384
7385
  return e > -1 && (e += r.length, r.length > 1 && (i[e] === t && e++, i[e] === t && e++)), e;
7385
7386
  }
7386
- let Mr = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
7387
- class de extends Date {
7387
+ let Tr = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
7388
+ class pe extends Date {
7388
7389
  #t = !1;
7389
7390
  #o = !1;
7390
7391
  #n = null;
7391
7392
  constructor(e) {
7392
7393
  let t = !0, r = !0, n = "Z";
7393
7394
  if (typeof e == "string") {
7394
- let o = e.match(Mr);
7395
+ let o = e.match(Tr);
7395
7396
  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 = "";
7396
7397
  }
7397
7398
  super(e), isNaN(this.getTime()) || (this.#t = t, this.#o = r, this.#n = n);
@@ -7425,23 +7426,23 @@ class de extends Date {
7425
7426
  return t = this.#n[0] === "-" ? t : -t, new Date(this.getTime() - t * 6e4).toISOString().slice(0, -1) + this.#n;
7426
7427
  }
7427
7428
  static wrapAsOffsetDateTime(e, t = "Z") {
7428
- let r = new de(e);
7429
+ let r = new pe(e);
7429
7430
  return r.#n = t, r;
7430
7431
  }
7431
7432
  static wrapAsLocalDateTime(e) {
7432
- let t = new de(e);
7433
+ let t = new pe(e);
7433
7434
  return t.#n = null, t;
7434
7435
  }
7435
7436
  static wrapAsLocalDate(e) {
7436
- let t = new de(e);
7437
+ let t = new pe(e);
7437
7438
  return t.#o = !1, t.#n = null, t;
7438
7439
  }
7439
7440
  static wrapAsLocalTime(e) {
7440
- let t = new de(e);
7441
+ let t = new pe(e);
7441
7442
  return t.#t = !1, t.#n = null, t;
7442
7443
  }
7443
7444
  }
7444
- 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 = {
7445
+ let Dr = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/, Or = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/, _r = /^[+-]?0[0-9_]/, Ar = /^[0-9a-f]{2,8}$/i, ht = {
7445
7446
  b: "\b",
7446
7447
  t: " ",
7447
7448
  n: `
@@ -7452,7 +7453,7 @@ let Tr = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/, Dr = /^
7452
7453
  '"': '"',
7453
7454
  "\\": "\\"
7454
7455
  };
7455
- function vt(i, e = 0, t = i.length) {
7456
+ function St(i, e = 0, t = i.length) {
7456
7457
  let r = i[e] === "'", n = i[e++] === i[e] && i[e] === i[e + 1];
7457
7458
  n && (t -= 2, i[e += 2] === "\r" && e++, i[e] === `
7458
7459
  ` && e++);
@@ -7475,7 +7476,7 @@ function vt(i, e = 0, t = i.length) {
7475
7476
  if (s) {
7476
7477
  if (s = !1, c === "x" || c === "u" || c === "U") {
7477
7478
  let u = i.slice(e, e += c === "x" ? 2 : c === "u" ? 4 : 8);
7478
- if (!_r.test(u))
7479
+ if (!Ar.test(u))
7479
7480
  throw new j("invalid unicode escape", {
7480
7481
  toml: i,
7481
7482
  ptr: o
@@ -7490,15 +7491,15 @@ function vt(i, e = 0, t = i.length) {
7490
7491
  }
7491
7492
  } else if (n && (c === `
7492
7493
  ` || c === " " || c === " " || c === "\r")) {
7493
- if (e = ae(i, e - 1, !0), i[e] !== `
7494
+ if (e = le(i, e - 1, !0), i[e] !== `
7494
7495
  ` && i[e] !== "\r")
7495
7496
  throw new j("invalid escape: only line-ending whitespace may be escaped", {
7496
7497
  toml: i,
7497
7498
  ptr: o
7498
7499
  });
7499
- e = ae(i, e);
7500
- } else if (c in pt)
7501
- a += pt[c];
7500
+ e = le(i, e);
7501
+ } else if (c in ht)
7502
+ a += ht[c];
7502
7503
  else
7503
7504
  throw new j("unrecognized escape sequence", {
7504
7505
  toml: i,
@@ -7509,7 +7510,7 @@ function vt(i, e = 0, t = i.length) {
7509
7510
  }
7510
7511
  return a + i.slice(l, t - 1);
7511
7512
  }
7512
- function Ar(i, e, t, r) {
7513
+ function Fr(i, e, t, r) {
7513
7514
  if (i === "true")
7514
7515
  return !0;
7515
7516
  if (i === "false")
@@ -7522,9 +7523,9 @@ function Ar(i, e, t, r) {
7522
7523
  return NaN;
7523
7524
  if (i === "-0")
7524
7525
  return r ? 0n : 0;
7525
- let n = Tr.test(i);
7526
- if (n || Dr.test(i)) {
7527
- if (Or.test(i))
7526
+ let n = Dr.test(i);
7527
+ if (n || Or.test(i)) {
7528
+ if (_r.test(i))
7528
7529
  throw new j("leading zeroes are not allowed", {
7529
7530
  toml: e,
7530
7531
  ptr: t
@@ -7546,7 +7547,7 @@ function Ar(i, e, t, r) {
7546
7547
  }
7547
7548
  return s;
7548
7549
  }
7549
- const o = new de(i);
7550
+ const o = new pe(i);
7550
7551
  if (!o.isValid())
7551
7552
  throw new j("invalid value", {
7552
7553
  toml: e,
@@ -7554,11 +7555,11 @@ function Ar(i, e, t, r) {
7554
7555
  });
7555
7556
  return o;
7556
7557
  }
7557
- function Fr(i, e, t) {
7558
+ function Nr(i, e, t) {
7558
7559
  let r = i.slice(e, t), n = r.indexOf("#");
7559
- return n > -1 && (Fe(i, n), r = r.slice(0, n)), [r.trimEnd(), n];
7560
+ return n > -1 && (Ne(i, n), r = r.slice(0, n)), [r.trimEnd(), n];
7560
7561
  }
7561
- function Ge(i, e, t, r, n) {
7562
+ function Je(i, e, t, r, n) {
7562
7563
  if (r === 0)
7563
7564
  throw new j("document contains excessively nested structures. aborting.", {
7564
7565
  toml: i,
@@ -7566,9 +7567,9 @@ function Ge(i, e, t, r, n) {
7566
7567
  });
7567
7568
  let o = i[e];
7568
7569
  if (o === "[" || o === "{") {
7569
- let [l, c] = o === "[" ? kr(i, e, r, n) : jr(i, e, r, n);
7570
+ let [l, c] = o === "[" ? Ir(i, e, r, n) : kr(i, e, r, n);
7570
7571
  if (t) {
7571
- if (c = ae(i, c), i[c] === ",")
7572
+ if (c = le(i, c), i[c] === ",")
7572
7573
  c++;
7573
7574
  else if (i[c] !== t)
7574
7575
  throw new j("expected comma or end of structure", {
@@ -7580,10 +7581,10 @@ function Ge(i, e, t, r, n) {
7580
7581
  }
7581
7582
  let s;
7582
7583
  if (o === '"' || o === "'") {
7583
- s = wt(i, e);
7584
- let l = vt(i, e, s);
7584
+ s = vt(i, e);
7585
+ let l = St(i, e, s);
7585
7586
  if (t) {
7586
- if (s = ae(i, s), i[s] && i[s] !== "," && i[s] !== t && i[s] !== `
7587
+ if (s = le(i, s), i[s] && i[s] !== "," && i[s] !== t && i[s] !== `
7587
7588
  ` && i[s] !== "\r")
7588
7589
  throw new j("unexpected character encountered", {
7589
7590
  toml: i,
@@ -7593,20 +7594,20 @@ function Ge(i, e, t, r, n) {
7593
7594
  }
7594
7595
  return [l, s];
7595
7596
  }
7596
- s = Pr(i, e, ",", t);
7597
- let a = Fr(i, e, s - +(i[s - 1] === ","));
7597
+ s = Mr(i, e, ",", t);
7598
+ let a = Nr(i, e, s - +(i[s - 1] === ","));
7598
7599
  if (!a[0])
7599
7600
  throw new j("incomplete key-value declaration: no value specified", {
7600
7601
  toml: i,
7601
7602
  ptr: e
7602
7603
  });
7603
- return t && a[1] > -1 && (s = ae(i, e + a[1]), s += +(i[s] === ",")), [
7604
- Ar(a[0], i, e, n),
7604
+ return t && a[1] > -1 && (s = le(i, e + a[1]), s += +(i[s] === ",")), [
7605
+ Fr(a[0], i, e, n),
7605
7606
  s
7606
7607
  ];
7607
7608
  }
7608
- let Nr = /^[a-zA-Z0-9-_]+[ \t]*$/;
7609
- function Be(i, e, t = "=") {
7609
+ let jr = /^[a-zA-Z0-9-_]+[ \t]*$/;
7610
+ function ze(i, e, t = "=") {
7610
7611
  let r = e - 1, n = [], o = i.indexOf(t, e);
7611
7612
  if (o < 0)
7612
7613
  throw new j("incomplete key-value: cannot find end of key", {
@@ -7622,14 +7623,14 @@ function Be(i, e, t = "=") {
7622
7623
  toml: i,
7623
7624
  ptr: e
7624
7625
  });
7625
- let a = wt(i, e);
7626
+ let a = vt(i, e);
7626
7627
  if (a < 0)
7627
7628
  throw new j("unfinished string encountered", {
7628
7629
  toml: i,
7629
7630
  ptr: e
7630
7631
  });
7631
7632
  r = i.indexOf(".", a);
7632
- let l = i.slice(a, r < 0 || r > o ? o : r), c = Ue(l);
7633
+ let l = i.slice(a, r < 0 || r > o ? o : r), c = Be(l);
7633
7634
  if (c > -1)
7634
7635
  throw new j("newlines are not allowed in keys", {
7635
7636
  toml: i,
@@ -7645,11 +7646,11 @@ function Be(i, e, t = "=") {
7645
7646
  toml: i,
7646
7647
  ptr: e
7647
7648
  });
7648
- n.push(vt(i, e, a));
7649
+ n.push(St(i, e, a));
7649
7650
  } else {
7650
7651
  r = i.indexOf(".", e);
7651
7652
  let a = i.slice(e, r < 0 || r > o ? o : r);
7652
- if (!Nr.test(a))
7653
+ if (!jr.test(a))
7653
7654
  throw new j("only letter, numbers, dashes and underscores are allowed in keys", {
7654
7655
  toml: i,
7655
7656
  ptr: e
@@ -7657,9 +7658,9 @@ function Be(i, e, t = "=") {
7657
7658
  n.push(a.trimEnd());
7658
7659
  }
7659
7660
  } while (r + 1 && r < o);
7660
- return [n, ae(i, o + 1, !0, !0)];
7661
+ return [n, le(i, o + 1, !0, !0)];
7661
7662
  }
7662
- function jr(i, e, t, r) {
7663
+ function kr(i, e, t, r) {
7663
7664
  let n = {}, o = /* @__PURE__ */ new Set(), s;
7664
7665
  for (e++; (s = i[e++]) !== "}" && s; ) {
7665
7666
  if (s === ",")
@@ -7668,10 +7669,10 @@ function jr(i, e, t, r) {
7668
7669
  ptr: e - 1
7669
7670
  });
7670
7671
  if (s === "#")
7671
- e = Fe(i, e);
7672
+ e = Ne(i, e);
7672
7673
  else if (s !== " " && s !== " " && s !== `
7673
7674
  ` && s !== "\r") {
7674
- let a, l = n, c = !1, [u, f] = Be(i, e - 1);
7675
+ let a, l = n, c = !1, [u, f] = ze(i, e - 1);
7675
7676
  for (let S = 0; S < u.length; S++) {
7676
7677
  if (S && (l = c ? l[a] : l[a] = {}), a = u[S], (c = Object.hasOwn(l, a)) && (typeof l[a] != "object" || o.has(l[a])))
7677
7678
  throw new j("trying to redefine an already defined value", {
@@ -7685,7 +7686,7 @@ function jr(i, e, t, r) {
7685
7686
  toml: i,
7686
7687
  ptr: e
7687
7688
  });
7688
- let [d, m] = Ge(i, f, "}", t - 1, r);
7689
+ let [d, m] = Je(i, f, "}", t - 1, r);
7689
7690
  o.add(d), l[a] = d, e = m;
7690
7691
  }
7691
7692
  }
@@ -7696,7 +7697,7 @@ function jr(i, e, t, r) {
7696
7697
  });
7697
7698
  return [n, e];
7698
7699
  }
7699
- function kr(i, e, t, r) {
7700
+ function Ir(i, e, t, r) {
7700
7701
  let n = [], o;
7701
7702
  for (e++; (o = i[e++]) !== "]" && o; ) {
7702
7703
  if (o === ",")
@@ -7705,10 +7706,10 @@ function kr(i, e, t, r) {
7705
7706
  ptr: e - 1
7706
7707
  });
7707
7708
  if (o === "#")
7708
- e = Fe(i, e);
7709
+ e = Ne(i, e);
7709
7710
  else if (o !== " " && o !== " " && o !== `
7710
7711
  ` && o !== "\r") {
7711
- let s = Ge(i, e - 1, "]", t - 1, r);
7712
+ let s = Je(i, e - 1, "]", t - 1, r);
7712
7713
  n.push(s[0]), e = s[1];
7713
7714
  }
7714
7715
  }
@@ -7719,7 +7720,7 @@ function kr(i, e, t, r) {
7719
7720
  });
7720
7721
  return [n, e];
7721
7722
  }
7722
- function ht(i, e, t, r) {
7723
+ function mt(i, e, t, r) {
7723
7724
  let n = e, o = t, s, a = !1, l;
7724
7725
  for (let c = 0; c < i.length; c++) {
7725
7726
  if (c) {
@@ -7747,11 +7748,11 @@ function ht(i, e, t, r) {
7747
7748
  return null;
7748
7749
  return [s, n, l.c];
7749
7750
  }
7750
- function St(i, { maxDepth: e = 1e3, integersAsBigInt: t } = {}) {
7751
+ function xt(i, { maxDepth: e = 1e3, integersAsBigInt: t } = {}) {
7751
7752
  let r = {}, n = {}, o = r, s = n;
7752
- for (let a = ae(i, 0); a < i.length; ) {
7753
+ for (let a = le(i, 0); a < i.length; ) {
7753
7754
  if (i[a] === "[") {
7754
- let l = i[++a] === "[", c = Be(i, a += +l, "]");
7755
+ let l = i[++a] === "[", c = ze(i, a += +l, "]");
7755
7756
  if (l) {
7756
7757
  if (i[c[1] - 1] !== "]")
7757
7758
  throw new j("expected end of table declaration", {
@@ -7760,7 +7761,7 @@ function St(i, { maxDepth: e = 1e3, integersAsBigInt: t } = {}) {
7760
7761
  });
7761
7762
  c[1]++;
7762
7763
  }
7763
- let u = ht(
7764
+ let u = mt(
7764
7765
  c[0],
7765
7766
  r,
7766
7767
  n,
@@ -7774,7 +7775,7 @@ function St(i, { maxDepth: e = 1e3, integersAsBigInt: t } = {}) {
7774
7775
  });
7775
7776
  s = u[2], o = u[1], a = c[1];
7776
7777
  } else {
7777
- let l = Be(i, a), c = ht(
7778
+ let l = ze(i, a), c = mt(
7778
7779
  l[0],
7779
7780
  o,
7780
7781
  s,
@@ -7786,21 +7787,21 @@ function St(i, { maxDepth: e = 1e3, integersAsBigInt: t } = {}) {
7786
7787
  toml: i,
7787
7788
  ptr: a
7788
7789
  });
7789
- let u = Ge(i, l[1], void 0, e, t);
7790
+ let u = Je(i, l[1], void 0, e, t);
7790
7791
  c[1][c[0]] = u[0], a = u[1];
7791
7792
  }
7792
- if (a = ae(i, a, !0), i[a] && i[a] !== `
7793
+ if (a = le(i, a, !0), i[a] && i[a] !== `
7793
7794
  ` && i[a] !== "\r")
7794
7795
  throw new j("each key-value declaration must be followed by an end-of-line", {
7795
7796
  toml: i,
7796
7797
  ptr: a
7797
7798
  });
7798
- a = ae(i, a);
7799
+ a = le(i, a);
7799
7800
  }
7800
7801
  return r;
7801
7802
  }
7802
- let xt = /^[a-z0-9-_]+$/i;
7803
- function ve(i) {
7803
+ let $t = /^[a-z0-9-_]+$/i;
7804
+ function Se(i) {
7804
7805
  let e = typeof i;
7805
7806
  if (e === "object") {
7806
7807
  if (Array.isArray(i))
@@ -7810,16 +7811,16 @@ function ve(i) {
7810
7811
  }
7811
7812
  return e;
7812
7813
  }
7813
- function Ir(i) {
7814
+ function Rr(i) {
7814
7815
  for (let e = 0; e < i.length; e++)
7815
- if (ve(i[e]) !== "object")
7816
+ if (Se(i[e]) !== "object")
7816
7817
  return !1;
7817
7818
  return i.length != 0;
7818
7819
  }
7819
- function Je(i) {
7820
+ function qe(i) {
7820
7821
  return JSON.stringify(i).replace(/\x7f/g, "\\u007f");
7821
7822
  }
7822
- function qe(i, e, t, r) {
7823
+ function Ze(i, e, t, r) {
7823
7824
  if (t === 0)
7824
7825
  throw new Error("Could not stringify the object: maximum object depth exceeded");
7825
7826
  if (e === "number")
@@ -7827,69 +7828,69 @@ function qe(i, e, t, r) {
7827
7828
  if (e === "bigint" || e === "boolean")
7828
7829
  return i.toString();
7829
7830
  if (e === "string")
7830
- return Je(i);
7831
+ return qe(i);
7831
7832
  if (e === "date") {
7832
7833
  if (isNaN(i.getTime()))
7833
7834
  throw new TypeError("cannot serialize invalid date");
7834
7835
  return i.toISOString();
7835
7836
  }
7836
7837
  if (e === "object")
7837
- return Rr(i, t, r);
7838
- if (e === "array")
7839
7838
  return Lr(i, t, r);
7839
+ if (e === "array")
7840
+ return Wr(i, t, r);
7840
7841
  }
7841
- function Rr(i, e, t) {
7842
+ function Lr(i, e, t) {
7842
7843
  let r = Object.keys(i);
7843
7844
  if (r.length === 0)
7844
7845
  return "{}";
7845
7846
  let n = "{ ";
7846
7847
  for (let o = 0; o < r.length; o++) {
7847
7848
  let s = r[o];
7848
- o && (n += ", "), n += xt.test(s) ? s : Je(s), n += " = ", n += qe(i[s], ve(i[s]), e - 1, t);
7849
+ o && (n += ", "), n += $t.test(s) ? s : qe(s), n += " = ", n += Ze(i[s], Se(i[s]), e - 1, t);
7849
7850
  }
7850
7851
  return n + " }";
7851
7852
  }
7852
- function Lr(i, e, t) {
7853
+ function Wr(i, e, t) {
7853
7854
  if (i.length === 0)
7854
7855
  return "[]";
7855
7856
  let r = "[ ";
7856
7857
  for (let n = 0; n < i.length; n++) {
7857
7858
  if (n && (r += ", "), i[n] === null || i[n] === void 0)
7858
7859
  throw new TypeError("arrays cannot contain null or undefined values");
7859
- r += qe(i[n], ve(i[n]), e - 1, t);
7860
+ r += Ze(i[n], Se(i[n]), e - 1, t);
7860
7861
  }
7861
7862
  return r + " ]";
7862
7863
  }
7863
- function Wr(i, e, t, r) {
7864
+ function Hr(i, e, t, r) {
7864
7865
  if (t === 0)
7865
7866
  throw new Error("Could not stringify the object: maximum object depth exceeded");
7866
7867
  let n = "";
7867
7868
  for (let o = 0; o < i.length; o++)
7868
7869
  n += `${n && `
7869
7870
  `}[[${e}]]
7870
- `, n += Ze(0, i[o], e, t, r);
7871
+ `, n += Ye(0, i[o], e, t, r);
7871
7872
  return n;
7872
7873
  }
7873
- function Ze(i, e, t, r, n) {
7874
+ function Ye(i, e, t, r, n) {
7874
7875
  if (r === 0)
7875
7876
  throw new Error("Could not stringify the object: maximum object depth exceeded");
7876
7877
  let o = "", s = "", a = Object.keys(e);
7877
7878
  for (let l = 0; l < a.length; l++) {
7878
7879
  let c = a[l];
7879
7880
  if (e[c] !== null && e[c] !== void 0) {
7880
- let u = ve(e[c]);
7881
+ let u = Se(e[c]);
7881
7882
  if (u === "symbol" || u === "function")
7882
7883
  throw new TypeError(`cannot serialize values of type '${u}'`);
7883
- let f = xt.test(c) ? c : Je(c);
7884
- if (u === "array" && Ir(e[c]))
7884
+ let f = $t.test(c) ? c : qe(c);
7885
+ if (u === "array" && Rr(e[c]))
7885
7886
  s += (s && `
7886
- `) + Wr(e[c], t ? `${t}.${f}` : f, r - 1, n);
7887
+ `) + Hr(e[c], t ? `${t}.${f}` : f, r - 1, n);
7887
7888
  else if (u === "object") {
7888
7889
  let d = t ? `${t}.${f}` : f;
7889
7890
  s += (s && `
7890
- `) + Ze(d, e[c], d, r - 1, n);
7891
+ `) + Ye(d, e[c], d, r - 1, n);
7891
7892
  } else
7892
- o += f, o += " = ", o += qe(e[c], u, r, n), o += `
7893
+ o += f, o += " = ", o += Ze(e[c], u, r, n), o += `
7893
7894
  `;
7894
7895
  }
7895
7896
  }
@@ -7897,72 +7898,72 @@ function Ze(i, e, t, r, n) {
7897
7898
  ${o}` : `[${i}]`), o && s ? `${o}
7898
7899
  ${s}` : o || s;
7899
7900
  }
7900
- function $t(i, { maxDepth: e = 1e3, numbersAsFloat: t = !1 } = {}) {
7901
- if (ve(i) !== "object")
7901
+ function Et(i, { maxDepth: e = 1e3, numbersAsFloat: t = !1 } = {}) {
7902
+ if (Se(i) !== "object")
7902
7903
  throw new TypeError("stringify can only be called with an object");
7903
- let r = Ze(0, i, "", e, t);
7904
+ let r = Ye(0, i, "", e, t);
7904
7905
  return r[r.length - 1] !== `
7905
7906
  ` ? r + `
7906
7907
  ` : r;
7907
7908
  }
7908
- const Hr = { parse: St, stringify: $t, TomlDate: de, TomlError: j }, Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7909
+ const Ur = { parse: xt, stringify: Et, TomlDate: pe, TomlError: j }, Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7909
7910
  __proto__: null,
7910
- TomlDate: de,
7911
+ TomlDate: pe,
7911
7912
  TomlError: j,
7912
- default: Hr,
7913
- parse: St,
7914
- stringify: $t
7913
+ default: Ur,
7914
+ parse: xt,
7915
+ stringify: Et
7915
7916
  }, Symbol.toStringTag, { value: "Module" }));
7916
7917
  export {
7917
- ye as ArgParser,
7918
+ be as ArgParser,
7918
7919
  G as ArgParserBase,
7919
- se as ArgParserError,
7920
- ln as ArgParserFuzzyTester,
7921
- hr as ArgParserMcp,
7922
- Ae as ConfigPlugin,
7923
- er as ConfigPluginRegistry,
7920
+ ie as ArgParserError,
7921
+ cn as ArgParserFuzzyTester,
7922
+ mr as ArgParserMcp,
7923
+ Fe as ConfigPlugin,
7924
+ tr as ConfigPluginRegistry,
7924
7925
  K as DxtPathResolver,
7925
- Qt as EnvConfigPlugin,
7926
- Ie as FlagInheritance,
7927
- Kt as JsonConfigPlugin,
7928
- fn as Logger,
7929
- Re as OutputSchemaPatterns,
7926
+ er as EnvConfigPlugin,
7927
+ Re as FlagInheritance,
7928
+ Qt as JsonConfigPlugin,
7929
+ dn as Logger,
7930
+ Le as OutputSchemaPatterns,
7930
7931
  y as SimpleChalk,
7931
- Oe as TomlConfigPlugin,
7932
- _e as YamlConfigPlugin,
7933
- tn as absolutePath,
7934
- nn as autoHelpHandler,
7935
- ur as convertFlagToJsonSchemaProperty,
7936
- sn as convertFlagsToJsonSchema,
7937
- ct as convertFlagsToZodSchema,
7938
- dn as createCliLogger,
7939
- an as createMcpArgParser,
7940
- ge as createMcpErrorResponse,
7941
- pn as createMcpLogger,
7942
- He as createMcpSuccessResponse,
7943
- fe as createOutputSchema,
7944
- mr as createTomlPlugin,
7945
- gr as createTomlPluginAsync,
7946
- br as createYamlPlugin,
7947
- wr as createYamlPluginAsync,
7948
- en as cwdRelative,
7932
+ _e as TomlConfigPlugin,
7933
+ Ae as YamlConfigPlugin,
7934
+ rn as absolutePath,
7935
+ on as autoHelpHandler,
7936
+ fr as convertFlagToJsonSchemaProperty,
7937
+ an as convertFlagsToJsonSchema,
7938
+ ut as convertFlagsToZodSchema,
7939
+ pn as createCliLogger,
7940
+ ln as createMcpArgParser,
7941
+ ye as createMcpErrorResponse,
7942
+ hn as createMcpLogger,
7943
+ Ue as createMcpSuccessResponse,
7944
+ de as createOutputSchema,
7945
+ gr as createTomlPlugin,
7946
+ yr as createTomlPluginAsync,
7947
+ wr as createYamlPlugin,
7948
+ vr as createYamlPluginAsync,
7949
+ tn as cwdRelative,
7949
7950
  U as debug,
7950
- Le as detectEntryPoint,
7951
- Xr as enableConfigPlugins,
7952
- Zr as enableOptionalConfigPlugins,
7953
- Yr as enableOptionalConfigPluginsAsync,
7954
- Qr as entryRelative,
7955
- fr as extractSimplifiedResponse,
7956
- ut as generateMcpToolsFromArgParser,
7957
- Kr as getEntryPointFromImportMeta,
7958
- De as getJsonSchemaTypeFromFlag,
7959
- ie as globalConfigPluginRegistry,
7960
- on as isValidMcpToolName,
7961
- rn as legacyCwdPath,
7962
- hn as logger,
7963
- ce as resolveLogPath,
7964
- We as sanitizeMcpToolName,
7965
- rr as zodDxtOptionsSchema,
7966
- nr as zodFlagSchema
7951
+ We as detectEntryPoint,
7952
+ Kr as enableConfigPlugins,
7953
+ Yr as enableOptionalConfigPlugins,
7954
+ Xr as enableOptionalConfigPluginsAsync,
7955
+ en as entryRelative,
7956
+ dr as extractSimplifiedResponse,
7957
+ ft as generateMcpToolsFromArgParser,
7958
+ Qr as getEntryPointFromImportMeta,
7959
+ Oe as getJsonSchemaTypeFromFlag,
7960
+ ae as globalConfigPluginRegistry,
7961
+ sn as isValidMcpToolName,
7962
+ nn as legacyCwdPath,
7963
+ mn as logger,
7964
+ ue as resolveLogPath,
7965
+ He as sanitizeMcpToolName,
7966
+ nr as zodDxtOptionsSchema,
7967
+ or as zodFlagSchema
7967
7968
  };
7968
7969
  //# sourceMappingURL=index.min.mjs.map