@alcyone-labs/arg-parser 2.1.1 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +251 -29
  2. package/dist/config/ConfigurationManager.d.ts.map +1 -1
  3. package/dist/config/plugins/ConfigPlugin.d.ts.map +1 -1
  4. package/dist/config/plugins/ConfigPluginRegistry.d.ts +1 -1
  5. package/dist/config/plugins/ConfigPluginRegistry.d.ts.map +1 -1
  6. package/dist/config/plugins/TomlConfigPlugin.d.ts +1 -1
  7. package/dist/config/plugins/TomlConfigPlugin.d.ts.map +1 -1
  8. package/dist/config/plugins/YamlConfigPlugin.d.ts +1 -1
  9. package/dist/config/plugins/YamlConfigPlugin.d.ts.map +1 -1
  10. package/dist/config/plugins/index.d.ts +4 -4
  11. package/dist/config/plugins/index.d.ts.map +1 -1
  12. package/dist/core/ArgParser.d.ts +17 -6
  13. package/dist/core/ArgParser.d.ts.map +1 -1
  14. package/dist/core/ArgParserBase.d.ts +8 -2
  15. package/dist/core/ArgParserBase.d.ts.map +1 -1
  16. package/dist/core/log-path-utils.d.ts +59 -0
  17. package/dist/core/log-path-utils.d.ts.map +1 -0
  18. package/dist/core/types.d.ts +6 -6
  19. package/dist/core/types.d.ts.map +1 -1
  20. package/dist/dxt/DxtGenerator.d.ts +5 -1
  21. package/dist/dxt/DxtGenerator.d.ts.map +1 -1
  22. package/dist/index.cjs +785 -195
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.ts +5 -4
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.min.mjs +5375 -4848
  27. package/dist/index.min.mjs.map +1 -1
  28. package/dist/index.mjs +785 -195
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/mcp/ArgParserMcp.d.ts.map +1 -1
  31. package/dist/mcp/mcp-notifications.d.ts +4 -4
  32. package/dist/mcp/mcp-notifications.d.ts.map +1 -1
  33. package/dist/mcp/mcp-prompts.d.ts.map +1 -1
  34. package/dist/mcp/mcp-protocol-versions.d.ts +11 -11
  35. package/dist/mcp/mcp-protocol-versions.d.ts.map +1 -1
  36. package/dist/mcp/mcp-resources.d.ts.map +1 -1
  37. package/dist/testing/fuzzy-test-cli.d.ts.map +1 -1
  38. package/dist/testing/fuzzy-tester.d.ts.map +1 -1
  39. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -325,7 +325,9 @@ class JsonConfigPlugin extends ConfigPlugin {
325
325
  const { _meta, ...config } = parsed;
326
326
  return config;
327
327
  } catch (error) {
328
- throw new Error(`Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`);
328
+ throw new Error(
329
+ `Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`
330
+ );
329
331
  }
330
332
  }
331
333
  generate(_config, flags, parsedArgs) {
@@ -541,7 +543,9 @@ function enableConfigPlugins(pluginNames) {
541
543
  globalConfigPluginRegistry.registerPlugin(tomlPlugin);
542
544
  }
543
545
  } catch (error) {
544
- console.warn(`Failed to enable TOML plugin: ${error instanceof Error ? error.message : String(error)}`);
546
+ console.warn(
547
+ `Failed to enable TOML plugin: ${error instanceof Error ? error.message : String(error)}`
548
+ );
545
549
  }
546
550
  break;
547
551
  case "yaml":
@@ -552,7 +556,9 @@ function enableConfigPlugins(pluginNames) {
552
556
  globalConfigPluginRegistry.registerPlugin(yamlPlugin);
553
557
  }
554
558
  } catch (error) {
555
- console.warn(`Failed to enable YAML plugin: ${error instanceof Error ? error.message : String(error)}`);
559
+ console.warn(
560
+ `Failed to enable YAML plugin: ${error instanceof Error ? error.message : String(error)}`
561
+ );
556
562
  }
557
563
  break;
558
564
  default:
@@ -576,14 +582,18 @@ class ConfigurationManager {
576
582
  } else if (appName && appName !== "Argument Parser") {
577
583
  baseName = appName;
578
584
  }
579
- baseName = baseName.split(/[\s-_]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join("");
585
+ baseName = baseName.split(/[\s-_]+/).map(
586
+ (word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
587
+ ).join("");
580
588
  return `${baseName}.env`;
581
589
  }
582
590
  /**
583
591
  * Handles the --s-save-to-env system flag at the final parser level
584
592
  */
585
593
  handleSaveToEnvFlag(processArgs, parserChain) {
586
- const saveToEnvIndex = processArgs.findIndex((arg) => arg === "--s-save-to-env");
594
+ const saveToEnvIndex = processArgs.findIndex(
595
+ (arg) => arg === "--s-save-to-env"
596
+ );
587
597
  if (saveToEnvIndex !== -1) {
588
598
  let filePath;
589
599
  if (saveToEnvIndex + 1 < processArgs.length) {
@@ -609,7 +619,11 @@ class ConfigurationManager {
609
619
  const finalParser = parserChain[parserChain.length - 1];
610
620
  const parsedArgs = finalParser.getLastParseResult();
611
621
  if (!parsedArgs) {
612
- console.log(simpleChalk.yellow("No parsed arguments available. Run the command first to generate configuration."));
622
+ console.log(
623
+ simpleChalk.yellow(
624
+ "No parsed arguments available. Run the command first to generate configuration."
625
+ )
626
+ );
613
627
  return;
614
628
  }
615
629
  const allFlags = [];
@@ -642,10 +656,18 @@ class ConfigurationManager {
642
656
  fs__namespace.writeFileSync(filePath, content, "utf8");
643
657
  console.log(simpleChalk.green(`✅ Configuration saved to: ${filePath}`));
644
658
  console.log(simpleChalk.gray(`Format: ${ext || ".env"}`));
645
- console.log(simpleChalk.gray(`Flags saved: ${Object.keys(parsedArgs.args).length}`));
659
+ console.log(
660
+ simpleChalk.gray(`Flags saved: ${Object.keys(parsedArgs.args).length}`)
661
+ );
646
662
  } catch (error) {
647
- console.error(simpleChalk.red(`❌ Failed to save configuration: ${error instanceof Error ? error.message : String(error)}`));
648
- throw new Error(`Failed to save configuration: ${error instanceof Error ? error.message : String(error)}`);
663
+ console.error(
664
+ simpleChalk.red(
665
+ `❌ Failed to save configuration: ${error instanceof Error ? error.message : String(error)}`
666
+ )
667
+ );
668
+ throw new Error(
669
+ `Failed to save configuration: ${error instanceof Error ? error.message : String(error)}`
670
+ );
649
671
  }
650
672
  }
651
673
  /**
@@ -682,7 +704,11 @@ class ConfigurationManager {
682
704
  }
683
705
  return this.convertConfigToFlagValues(rawConfig, parserChain);
684
706
  } catch (error) {
685
- console.warn(simpleChalk.yellow(`Warning: Could not load config file ${filePath}: ${error instanceof Error ? error.message : String(error)}`));
707
+ console.warn(
708
+ simpleChalk.yellow(
709
+ `Warning: Could not load config file ${filePath}: ${error instanceof Error ? error.message : String(error)}`
710
+ )
711
+ );
686
712
  return {};
687
713
  }
688
714
  }
@@ -716,7 +742,9 @@ class ConfigurationManager {
716
742
  if (plugin) {
717
743
  return plugin.parse(content);
718
744
  }
719
- console.warn("YAML plugin not available, using simple parser. Install js-yaml and enable YAML plugin for full support.");
745
+ console.warn(
746
+ "YAML plugin not available, using simple parser. Install js-yaml and enable YAML plugin for full support."
747
+ );
720
748
  const config = {};
721
749
  const lines = content.split("\n");
722
750
  let currentKey = null;
@@ -767,7 +795,9 @@ class ConfigurationManager {
767
795
  try {
768
796
  return JSON.parse(content) || {};
769
797
  } catch (error) {
770
- throw new Error(`Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`);
798
+ throw new Error(
799
+ `Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`
800
+ );
771
801
  }
772
802
  }
773
803
  /**
@@ -778,7 +808,9 @@ class ConfigurationManager {
778
808
  if (plugin) {
779
809
  return plugin.parse(content);
780
810
  }
781
- console.warn("TOML plugin not available, using simple parser. Install smol-toml and enable TOML plugin for full support.");
811
+ console.warn(
812
+ "TOML plugin not available, using simple parser. Install smol-toml and enable TOML plugin for full support."
813
+ );
782
814
  const config = {};
783
815
  const lines = content.split("\n");
784
816
  for (const line of lines) {
@@ -809,13 +841,19 @@ class ConfigurationManager {
809
841
  for (const [key, value] of Object.entries(rawConfig)) {
810
842
  let flag = allFlags.find((f) => f["name"] === key);
811
843
  if (!flag) {
812
- flag = allFlags.find((f) => f["name"].toLowerCase() === key.toLowerCase());
844
+ flag = allFlags.find(
845
+ (f) => f["name"].toLowerCase() === key.toLowerCase()
846
+ );
813
847
  }
814
848
  if (flag) {
815
849
  try {
816
850
  flagValues[flag["name"]] = this.convertValueToFlagType(value, flag);
817
851
  } catch (error) {
818
- console.warn(simpleChalk.yellow(`Warning: Could not convert config value for flag '${key}': ${error instanceof Error ? error.message : String(error)}`));
852
+ console.warn(
853
+ simpleChalk.yellow(
854
+ `Warning: Could not convert config value for flag '${key}': ${error instanceof Error ? error.message : String(error)}`
855
+ )
856
+ );
819
857
  }
820
858
  }
821
859
  }
@@ -852,17 +890,23 @@ class ConfigurationManager {
852
890
  }
853
891
  const num = Number(value);
854
892
  if (isNaN(num)) {
855
- throw new Error(`Cannot convert '${value}' to number for flag '${flag["name"]}'`);
893
+ throw new Error(
894
+ `Cannot convert '${value}' to number for flag '${flag["name"]}'`
895
+ );
856
896
  }
857
897
  return num;
858
898
  } else if (isBooleanType) {
859
899
  if (typeof value === "boolean") return value;
860
900
  if (typeof value === "string") {
861
901
  const lower = value.toLowerCase();
862
- if (lower === "true" || lower === "1" || lower === "yes" || lower === "on") return true;
863
- if (lower === "false" || lower === "0" || lower === "no" || lower === "off") return false;
902
+ if (lower === "true" || lower === "1" || lower === "yes" || lower === "on")
903
+ return true;
904
+ if (lower === "false" || lower === "0" || lower === "no" || lower === "off")
905
+ return false;
864
906
  }
865
- throw new Error(`Cannot convert '${value}' to boolean for flag '${flag["name"]}'`);
907
+ throw new Error(
908
+ `Cannot convert '${value}' to boolean for flag '${flag["name"]}'`
909
+ );
866
910
  } else if (flagType === "table") {
867
911
  if (Array.isArray(value)) return value;
868
912
  if (typeof value === "string") {
@@ -873,13 +917,17 @@ class ConfigurationManager {
873
917
  return value.split(",").map((v) => v.trim());
874
918
  }
875
919
  }
876
- throw new Error(`Cannot convert '${value}' to table for flag '${flag["name"]}'`);
920
+ throw new Error(
921
+ `Cannot convert '${value}' to table for flag '${flag["name"]}'`
922
+ );
877
923
  } else {
878
924
  if (typeof flagType === "function") {
879
925
  try {
880
926
  return flagType(value);
881
927
  } catch (error) {
882
- throw new Error(`Custom type conversion failed for flag '${flag["name"]}': ${error instanceof Error ? error.message : String(error)}`);
928
+ throw new Error(
929
+ `Custom type conversion failed for flag '${flag["name"]}': ${error instanceof Error ? error.message : String(error)}`
930
+ );
883
931
  }
884
932
  }
885
933
  return String(value);
@@ -954,7 +1002,9 @@ class ConfigurationManager {
954
1002
  if (Array.isArray(value)) {
955
1003
  lines.push(`${flag["name"]}:`);
956
1004
  for (const item of value) {
957
- lines.push(` - ${typeof item === "string" && item.includes(" ") ? `"${item}"` : item}`);
1005
+ lines.push(
1006
+ ` - ${typeof item === "string" && item.includes(" ") ? `"${item}"` : item}`
1007
+ );
958
1008
  }
959
1009
  } else if (typeof value === "string" && value.includes(" ")) {
960
1010
  lines.push(`${flag["name"]}: "${value}"`);
@@ -1055,8 +1105,8 @@ const zodFlagSchema = zod.z.object({
1055
1105
  // Native Object constructor
1056
1106
  message: "Must be Object constructor"
1057
1107
  }),
1058
- zod.z.function().args(zod.z.string()).returns(zod.z.any()),
1059
- // Custom parser function (value: string) => any
1108
+ zod.z.function().args(zod.z.string()).returns(zod.z.union([zod.z.any(), zod.z.promise(zod.z.any())])),
1109
+ // Custom parser function (value: string) => any | Promise<any>
1060
1110
  zod.z.string().refine(
1061
1111
  // String literal types
1062
1112
  (value) => ["boolean", "string", "number", "array", "object"].includes(
@@ -1217,22 +1267,46 @@ class DxtGenerator {
1217
1267
  try {
1218
1268
  const isTestMode = process.env["NODE_ENV"] === "test" || ((_a = process.argv[0]) == null ? void 0 : _a.includes("vitest")) || ((_b = process.argv[1]) == null ? void 0 : _b.includes("vitest")) || ((_c = process.argv[1]) == null ? void 0 : _c.includes("tinypool"));
1219
1269
  if (isTestMode) {
1220
- return await this.handleTestModeDxtGeneration(processArgs, buildDxtIndex);
1270
+ return await this.handleTestModeDxtGeneration(
1271
+ processArgs,
1272
+ buildDxtIndex
1273
+ );
1221
1274
  }
1222
1275
  const entryPointFile = process.argv[1];
1223
1276
  if (!entryPointFile || !fs__namespace.existsSync(entryPointFile)) {
1224
- console.error(simpleChalk.red(`Error: Entry point file not found: ${entryPointFile}`));
1277
+ console.error(
1278
+ simpleChalk.red(`Error: Entry point file not found: ${entryPointFile}`)
1279
+ );
1225
1280
  return this._handleExit(1, "Entry point file not found", "error");
1226
1281
  }
1227
- console.log(simpleChalk.cyan(`
1228
- 🔧 Building DXT package for entry point: ${path__namespace.basename(entryPointFile)}`));
1229
- await this.buildDxtWithTsdown(entryPointFile);
1282
+ const outputDir = processArgs[buildDxtIndex + 1] || "./dxt";
1283
+ console.log(
1284
+ simpleChalk.cyan(
1285
+ `
1286
+ 🔧 Building DXT package for entry point: ${path__namespace.basename(entryPointFile)}`
1287
+ )
1288
+ );
1289
+ console.log(simpleChalk.gray(`Output directory: ${outputDir}`));
1290
+ await this.buildDxtWithTsdown(entryPointFile, outputDir);
1230
1291
  console.log(simpleChalk.green(`
1231
1292
  ✅ DXT package generation completed!`));
1232
- return this._handleExit(0, "DXT package generation completed", "success", { entryPoint: entryPointFile });
1293
+ return this._handleExit(
1294
+ 0,
1295
+ "DXT package generation completed",
1296
+ "success",
1297
+ { entryPoint: entryPointFile, outputDir }
1298
+ );
1233
1299
  } catch (error) {
1234
- console.error(simpleChalk.red(`Error generating DXT package: ${error instanceof Error ? error.message : String(error)}`));
1235
- return this._handleExit(1, `Error generating DXT package: ${error instanceof Error ? error.message : String(error)}`, "error");
1300
+ console.error(
1301
+ simpleChalk.red(
1302
+ `Error generating DXT package: ${error instanceof Error ? error.message : String(error)}`
1303
+ )
1304
+ );
1305
+ return this._handleExit(
1306
+ 1,
1307
+ `Error generating DXT package: ${error instanceof Error ? error.message : String(error)}`,
1308
+ "error"
1309
+ );
1236
1310
  }
1237
1311
  }
1238
1312
  /**
@@ -1272,7 +1346,10 @@ class DxtGenerator {
1272
1346
  })),
1273
1347
  icon: "logo.jpg"
1274
1348
  };
1275
- fs__namespace.writeFileSync(path__namespace.join(buildDir, "manifest.json"), JSON.stringify(manifest, null, 2));
1349
+ fs__namespace.writeFileSync(
1350
+ path__namespace.join(buildDir, "manifest.json"),
1351
+ JSON.stringify(manifest, null, 2)
1352
+ );
1276
1353
  const packageJson = {
1277
1354
  name: serverInfo.name,
1278
1355
  version: serverInfo.version,
@@ -1280,7 +1357,10 @@ class DxtGenerator {
1280
1357
  main: "index.mjs",
1281
1358
  type: "module"
1282
1359
  };
1283
- fs__namespace.writeFileSync(path__namespace.join(buildDir, "package.json"), JSON.stringify(packageJson, null, 2));
1360
+ fs__namespace.writeFileSync(
1361
+ path__namespace.join(buildDir, "package.json"),
1362
+ JSON.stringify(packageJson, null, 2)
1363
+ );
1284
1364
  const readme = `# ${serverInfo.name}
1285
1365
 
1286
1366
  ${serverInfo.description}
@@ -1289,13 +1369,25 @@ Generated by @alcyone-labs/arg-parser`;
1289
1369
  fs__namespace.writeFileSync(path__namespace.join(buildDir, "README.md"), readme);
1290
1370
  const buildScript = `#!/bin/bash
1291
1371
  echo "Mock DXT build script for ${serverInfo.name}"`;
1292
- fs__namespace.writeFileSync(path__namespace.join(buildDir, "build-dxt-package.sh"), buildScript);
1293
- return this._handleExit(0, "DXT package generation completed", "success", {
1294
- entryPoint: "test-mode",
1295
- outputDir: buildDir
1296
- });
1372
+ fs__namespace.writeFileSync(
1373
+ path__namespace.join(buildDir, "build-dxt-package.sh"),
1374
+ buildScript
1375
+ );
1376
+ return this._handleExit(
1377
+ 0,
1378
+ "DXT package generation completed",
1379
+ "success",
1380
+ {
1381
+ entryPoint: "test-mode",
1382
+ outputDir: buildDir
1383
+ }
1384
+ );
1297
1385
  } catch (error) {
1298
- return this._handleExit(1, `Test mode DXT generation failed: ${error instanceof Error ? error.message : String(error)}`, "error");
1386
+ return this._handleExit(
1387
+ 1,
1388
+ `Test mode DXT generation failed: ${error instanceof Error ? error.message : String(error)}`,
1389
+ "error"
1390
+ );
1299
1391
  }
1300
1392
  }
1301
1393
  /**
@@ -1316,9 +1408,17 @@ echo "Mock DXT build script for ${serverInfo.name}"`;
1316
1408
  fs__namespace.mkdirSync(serverDir, { recursive: true });
1317
1409
  }
1318
1410
  const logoFilename = await this.addLogoToFolder(buildDir, serverInfo);
1319
- const manifest = this.createDxtManifest(serverInfo, tools, mcpSubCommand, logoFilename);
1411
+ const manifest = this.createDxtManifest(
1412
+ serverInfo,
1413
+ tools,
1414
+ mcpSubCommand,
1415
+ logoFilename
1416
+ );
1320
1417
  this.validateDxtManifest(manifest);
1321
- fs__namespace.writeFileSync(path__namespace.join(buildDir, "manifest.json"), JSON.stringify(manifest, null, 2));
1418
+ fs__namespace.writeFileSync(
1419
+ path__namespace.join(buildDir, "manifest.json"),
1420
+ JSON.stringify(manifest, null, 2)
1421
+ );
1322
1422
  this.addOriginalCliToFolder(buildDir);
1323
1423
  const bundledCliPath = await this.bundleOriginalCliWithTsdown(serverDir);
1324
1424
  const serverScript = this.createServerScript(serverInfo, bundledCliPath);
@@ -1327,10 +1427,16 @@ echo "Mock DXT build script for ${serverInfo.name}"`;
1327
1427
  try {
1328
1428
  fs__namespace.chmodSync(serverScriptPath, 493);
1329
1429
  } catch (error) {
1330
- console.warn("⚠ Could not set executable permission on server script:", error instanceof Error ? error.message : String(error));
1430
+ console.warn(
1431
+ "⚠ Could not set executable permission on server script:",
1432
+ error instanceof Error ? error.message : String(error)
1433
+ );
1331
1434
  }
1332
1435
  const packageJson = this.createDxtPackageJson(serverInfo);
1333
- fs__namespace.writeFileSync(path__namespace.join(buildDir, "package.json"), JSON.stringify(packageJson, null, 2));
1436
+ fs__namespace.writeFileSync(
1437
+ path__namespace.join(buildDir, "package.json"),
1438
+ JSON.stringify(packageJson, null, 2)
1439
+ );
1334
1440
  const readme = this.createDxtReadme(serverInfo);
1335
1441
  fs__namespace.writeFileSync(path__namespace.join(buildDir, "README.md"), readme);
1336
1442
  const buildScript = this.createSimpleBuildScript(serverInfo);
@@ -1342,11 +1448,15 @@ echo "Mock DXT build script for ${serverInfo.name}"`;
1342
1448
  } catch (error) {
1343
1449
  }
1344
1450
  console.log(simpleChalk.green(` ✓ Generated DXT package folder: ${folderName}`));
1345
- console.log(simpleChalk.gray(` Server: ${serverInfo.name} v${serverInfo.version}`));
1451
+ console.log(
1452
+ simpleChalk.gray(` Server: ${serverInfo.name} v${serverInfo.version}`)
1453
+ );
1346
1454
  console.log(simpleChalk.gray(` Tools: ${tools.length} tool(s)`));
1347
1455
  console.log(simpleChalk.gray(` Location: ${buildDir}`));
1348
- console.log(simpleChalk.cyan(`
1349
- 📦 Creating DXT package using Anthropic's dxt pack...`));
1456
+ console.log(
1457
+ simpleChalk.cyan(`
1458
+ 📦 Creating DXT package using Anthropic's dxt pack...`)
1459
+ );
1350
1460
  console.log(simpleChalk.cyan(`
1351
1461
  📋 Manual steps to create your DXT package:`));
1352
1462
  console.log(simpleChalk.white(` cd ${path__namespace.relative(process.cwd(), buildDir)}`));
@@ -1409,7 +1519,9 @@ echo "Mock DXT build script for ${serverInfo.name}"`;
1409
1519
  toolOptions = mcpConfig.toolOptions;
1410
1520
  }
1411
1521
  }
1412
- const mcpTools = this.argParserInstance.toMcpTools(toolOptions);
1522
+ const mcpTools = this.argParserInstance.toMcpTools(
1523
+ toolOptions
1524
+ );
1413
1525
  return mcpTools.map((tool) => ({
1414
1526
  name: tool.name,
1415
1527
  description: tool.description
@@ -1433,16 +1545,24 @@ echo "Mock DXT build script for ${serverInfo.name}"`;
1433
1545
  });
1434
1546
  }
1435
1547
  }
1436
- return tools.length > 0 ? tools : [{
1437
- name: "main",
1438
- description: "Main command tool"
1439
- }];
1548
+ return tools.length > 0 ? tools : [
1549
+ {
1550
+ name: "main",
1551
+ description: "Main command tool"
1552
+ }
1553
+ ];
1440
1554
  } catch (error) {
1441
- console.warn(simpleChalk.yellow(`Warning: Could not generate detailed tool list: ${error instanceof Error ? error.message : String(error)}`));
1442
- return [{
1443
- name: "main",
1444
- description: "Main command tool"
1445
- }];
1555
+ console.warn(
1556
+ simpleChalk.yellow(
1557
+ `Warning: Could not generate detailed tool list: ${error instanceof Error ? error.message : String(error)}`
1558
+ )
1559
+ );
1560
+ return [
1561
+ {
1562
+ name: "main",
1563
+ description: "Main command tool"
1564
+ }
1565
+ ];
1446
1566
  }
1447
1567
  }
1448
1568
  createDxtManifest(serverInfo, tools, mcpSubCommand, logoFilename) {
@@ -1465,7 +1585,9 @@ echo "Mock DXT build script for ${serverInfo.name}"`;
1465
1585
  }
1466
1586
  }
1467
1587
  if (!author) {
1468
- throw new Error("DXT manifest requires author information. Please provide it via withMcp() serverInfo.author, addMcpSubCommand serverInfo.author, or in package.json");
1588
+ throw new Error(
1589
+ "DXT manifest requires author information. Please provide it via withMcp() serverInfo.author, addMcpSubCommand serverInfo.author, or in package.json"
1590
+ );
1469
1591
  }
1470
1592
  const cliArgs = this.generateCliArgsForDxt(mcpSubCommand);
1471
1593
  const { envVars, userConfig } = this.generateEnvAndUserConfig();
@@ -1508,31 +1630,41 @@ echo "Mock DXT build script for ${serverInfo.name}"`;
1508
1630
  }
1509
1631
  validateDxtManifest(manifest) {
1510
1632
  const errors = [];
1511
- if (!manifest.dxt_version) errors.push("Missing required field: dxt_version");
1633
+ if (!manifest.dxt_version)
1634
+ errors.push("Missing required field: dxt_version");
1512
1635
  if (!manifest.name) errors.push("Missing required field: name");
1513
1636
  if (!manifest.version) errors.push("Missing required field: version");
1514
1637
  if (!manifest.server) errors.push("Missing required field: server");
1515
1638
  if (!manifest.author) errors.push("Missing required field: author");
1516
1639
  if (manifest.server) {
1517
- if (!manifest.server.type) errors.push("Missing required field: server.type");
1518
- if (!manifest.server.entry_point) errors.push("Missing required field: server.entry_point");
1519
- if (!manifest.server.mcp_config) errors.push("Missing required field: server.mcp_config");
1640
+ if (!manifest.server.type)
1641
+ errors.push("Missing required field: server.type");
1642
+ if (!manifest.server.entry_point)
1643
+ errors.push("Missing required field: server.entry_point");
1644
+ if (!manifest.server.mcp_config)
1645
+ errors.push("Missing required field: server.mcp_config");
1520
1646
  if (manifest.server.mcp_config) {
1521
- if (!manifest.server.mcp_config.command) errors.push("Missing required field: server.mcp_config.command");
1647
+ if (!manifest.server.mcp_config.command)
1648
+ errors.push("Missing required field: server.mcp_config.command");
1522
1649
  if (!manifest.server.mcp_config.args || !Array.isArray(manifest.server.mcp_config.args)) {
1523
- errors.push("Missing or invalid field: server.mcp_config.args (must be array)");
1650
+ errors.push(
1651
+ "Missing or invalid field: server.mcp_config.args (must be array)"
1652
+ );
1524
1653
  }
1525
1654
  }
1526
1655
  }
1527
1656
  if (manifest.author && typeof manifest.author === "object") {
1528
- if (!manifest.author.name) errors.push("Missing required field: author.name");
1657
+ if (!manifest.author.name)
1658
+ errors.push("Missing required field: author.name");
1529
1659
  }
1530
1660
  if (manifest.dxt_version && manifest.dxt_version !== "0.1") {
1531
1661
  errors.push("Unsupported dxt_version: only '0.1' is currently supported");
1532
1662
  }
1533
1663
  if (errors.length > 0) {
1534
- throw new Error(`DXT manifest validation failed:
1535
- ${errors.map((e) => ` - ${e}`).join("\n")}`);
1664
+ throw new Error(
1665
+ `DXT manifest validation failed:
1666
+ ${errors.map((e) => ` - ${e}`).join("\n")}`
1667
+ );
1536
1668
  }
1537
1669
  }
1538
1670
  createServerScript(serverInfo, bundledCliPath) {
@@ -1576,27 +1708,34 @@ originalCli.parse(['--s-mcp-serve']);
1576
1708
  try {
1577
1709
  const originalPackageJsonPath = path__namespace.join(process.cwd(), "package.json");
1578
1710
  if (fs__namespace.existsSync(originalPackageJsonPath)) {
1579
- const originalPackageJson = JSON.parse(fs__namespace.readFileSync(originalPackageJsonPath, "utf8"));
1711
+ const originalPackageJson = JSON.parse(
1712
+ fs__namespace.readFileSync(originalPackageJsonPath, "utf8")
1713
+ );
1580
1714
  originalDependencies = originalPackageJson.dependencies || {};
1581
1715
  }
1582
1716
  } catch (error) {
1583
- console.warn("⚠ Could not read original package.json for dependencies:", error instanceof Error ? error.message : String(error));
1717
+ console.warn(
1718
+ "⚠ Could not read original package.json for dependencies:",
1719
+ error instanceof Error ? error.message : String(error)
1720
+ );
1584
1721
  }
1585
1722
  const dependencies2 = {
1586
1723
  ...originalDependencies,
1587
1724
  "@alcyone-labs/arg-parser": argParserDependency,
1588
1725
  "@alcyone-labs/simple-mcp-logger": "^1.0.0",
1589
1726
  "@modelcontextprotocol/sdk": "^1.15.0",
1590
- "zod": "^3.22.4"
1727
+ zod: "^3.22.4"
1591
1728
  };
1592
1729
  const devDependencies = {
1593
- "tsup": "^8.3.5"
1730
+ tsup: "^8.3.5"
1594
1731
  };
1595
1732
  Object.keys(dependencies2).forEach((key) => {
1596
1733
  const depValue = dependencies2[key];
1597
1734
  if (key !== "@alcyone-labs/arg-parser" && typeof depValue === "string" && depValue.startsWith("file:")) {
1598
1735
  delete dependencies2[key];
1599
- console.warn(`⚠ Removed file: dependency ${key} from DXT package (not suitable for distribution)`);
1736
+ console.warn(
1737
+ `⚠ Removed file: dependency ${key} from DXT package (not suitable for distribution)`
1738
+ );
1600
1739
  }
1601
1740
  });
1602
1741
  return {
@@ -1942,7 +2081,7 @@ For autonomous packages, follow the build instructions above.
1942
2081
  * Adds the logo to the build folder if available
1943
2082
  * @returns The filename of the logo that was added, or undefined if no logo was added
1944
2083
  */
1945
- async addLogoToFolder(buildDir, serverInfo) {
2084
+ async addLogoToFolder(buildDir, serverInfo, entryPointFile) {
1946
2085
  try {
1947
2086
  let logoBuffer = null;
1948
2087
  let logoFilename = "logo.jpg";
@@ -1961,13 +2100,27 @@ For autonomous packages, follow the build instructions above.
1961
2100
  }
1962
2101
  console.log("✓ Downloaded logo from URL");
1963
2102
  } else {
1964
- console.warn(`⚠ Failed to download logo: HTTP ${response.status}`);
2103
+ console.warn(
2104
+ `⚠ Failed to download logo: HTTP ${response.status}`
2105
+ );
1965
2106
  }
1966
2107
  } catch (error) {
1967
- console.warn("⚠ Failed to download logo from URL:", error instanceof Error ? error.message : String(error));
2108
+ console.warn(
2109
+ "⚠ Failed to download logo from URL:",
2110
+ error instanceof Error ? error.message : String(error)
2111
+ );
1968
2112
  }
1969
2113
  } else {
1970
- const logoPath = path__namespace.resolve(customLogo);
2114
+ let logoPath;
2115
+ if (entryPointFile && !path__namespace.isAbsolute(customLogo)) {
2116
+ const entryDir = path__namespace.dirname(entryPointFile);
2117
+ logoPath = path__namespace.resolve(entryDir, customLogo);
2118
+ console.log(
2119
+ `📍 Resolving logo path relative to entry point: ${logoPath}`
2120
+ );
2121
+ } else {
2122
+ logoPath = path__namespace.resolve(customLogo);
2123
+ }
1971
2124
  if (fs__namespace.existsSync(logoPath)) {
1972
2125
  logoBuffer = fs__namespace.readFileSync(logoPath);
1973
2126
  logoFilename = path__namespace.basename(logoPath);
@@ -1981,17 +2134,32 @@ For autonomous packages, follow the build instructions above.
1981
2134
  const currentDir = path__namespace.dirname(new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href).pathname);
1982
2135
  let logoPath = path__namespace.join(currentDir, "assets", "logo_1_small.jpg");
1983
2136
  if (!fs__namespace.existsSync(logoPath)) {
1984
- logoPath = path__namespace.join(currentDir, "..", "docs", "MCP", "icons", "logo_1_small.jpg");
2137
+ logoPath = path__namespace.join(
2138
+ currentDir,
2139
+ "..",
2140
+ "docs",
2141
+ "MCP",
2142
+ "icons",
2143
+ "logo_1_small.jpg"
2144
+ );
1985
2145
  }
1986
2146
  if (!fs__namespace.existsSync(logoPath)) {
1987
- logoPath = path__namespace.join(process.cwd(), "docs", "MCP", "icons", "logo_1_small.jpg");
2147
+ logoPath = path__namespace.join(
2148
+ process.cwd(),
2149
+ "docs",
2150
+ "MCP",
2151
+ "icons",
2152
+ "logo_1_small.jpg"
2153
+ );
1988
2154
  }
1989
2155
  if (fs__namespace.existsSync(logoPath)) {
1990
2156
  logoBuffer = fs__namespace.readFileSync(logoPath);
1991
2157
  logoFilename = "logo.jpg";
1992
2158
  console.log("✓ Added default logo to build folder");
1993
2159
  } else {
1994
- console.warn("⚠ No logo found (custom or default), build folder will be created without icon");
2160
+ console.warn(
2161
+ "⚠ No logo found (custom or default), build folder will be created without icon"
2162
+ );
1995
2163
  return void 0;
1996
2164
  }
1997
2165
  }
@@ -2001,7 +2169,10 @@ For autonomous packages, follow the build instructions above.
2001
2169
  }
2002
2170
  return void 0;
2003
2171
  } catch (error) {
2004
- console.warn("⚠ Failed to add logo to build folder:", error instanceof Error ? error.message : String(error));
2172
+ console.warn(
2173
+ "⚠ Failed to add logo to build folder:",
2174
+ error instanceof Error ? error.message : String(error)
2175
+ );
2005
2176
  return void 0;
2006
2177
  }
2007
2178
  }
@@ -2051,7 +2222,12 @@ globalThis.console = {
2051
2222
  }
2052
2223
  }
2053
2224
  if (lastImportIndex >= 0) {
2054
- lines.splice(lastImportIndex + 1, 0, "", ...consoleReplacement.trim().split("\n"));
2225
+ lines.splice(
2226
+ lastImportIndex + 1,
2227
+ 0,
2228
+ "",
2229
+ ...consoleReplacement.trim().split("\n")
2230
+ );
2055
2231
  return lines.join("\n");
2056
2232
  } else {
2057
2233
  return consoleReplacement + cliSource;
@@ -2076,14 +2252,32 @@ globalThis.console = {
2076
2252
  path__namespace.join(process.cwd(), `${appCommandName}.js`),
2077
2253
  path__namespace.join(process.cwd(), `${appCommandName}.mjs`),
2078
2254
  // Look for files with the app command name (sanitized)
2079
- path__namespace.join(process.cwd(), `${appCommandName.replace(/[^a-zA-Z0-9-]/g, "-")}.js`),
2080
- path__namespace.join(process.cwd(), `${appCommandName.replace(/[^a-zA-Z0-9-]/g, "-")}.mjs`),
2255
+ path__namespace.join(
2256
+ process.cwd(),
2257
+ `${appCommandName.replace(/[^a-zA-Z0-9-]/g, "-")}.js`
2258
+ ),
2259
+ path__namespace.join(
2260
+ process.cwd(),
2261
+ `${appCommandName.replace(/[^a-zA-Z0-9-]/g, "-")}.mjs`
2262
+ ),
2081
2263
  // Look for files with app name patterns
2082
- path__namespace.join(process.cwd(), `${appName.toLowerCase().replace(/\s+/g, "-")}-cli.js`),
2083
- path__namespace.join(process.cwd(), `${appName.toLowerCase().replace(/\s+/g, "-")}-cli.mjs`),
2264
+ path__namespace.join(
2265
+ process.cwd(),
2266
+ `${appName.toLowerCase().replace(/\s+/g, "-")}-cli.js`
2267
+ ),
2268
+ path__namespace.join(
2269
+ process.cwd(),
2270
+ `${appName.toLowerCase().replace(/\s+/g, "-")}-cli.mjs`
2271
+ ),
2084
2272
  // Look for files with first word of app name + cli
2085
- path__namespace.join(process.cwd(), `${appName.split(" ")[0].toLowerCase()}-cli.js`),
2086
- path__namespace.join(process.cwd(), `${appName.split(" ")[0].toLowerCase()}-cli.mjs`)
2273
+ path__namespace.join(
2274
+ process.cwd(),
2275
+ `${appName.split(" ")[0].toLowerCase()}-cli.js`
2276
+ ),
2277
+ path__namespace.join(
2278
+ process.cwd(),
2279
+ `${appName.split(" ")[0].toLowerCase()}-cli.mjs`
2280
+ )
2087
2281
  ];
2088
2282
  let cliSourcePath = null;
2089
2283
  for (const filePath of possibleCliFiles) {
@@ -2103,7 +2297,9 @@ globalThis.console = {
2103
2297
  "import $1 from '@alcyone-labs/arg-parser';"
2104
2298
  );
2105
2299
  cliSource = this.processCliSourceForMcp(cliSource);
2106
- const parserVariableMatch = cliSource.match(/const\s+(\w+)\s*=\s*ArgParser\.withMcp\(/);
2300
+ const parserVariableMatch = cliSource.match(
2301
+ /const\s+(\w+)\s*=\s*ArgParser\.withMcp\(/
2302
+ );
2107
2303
  if (parserVariableMatch) {
2108
2304
  const parserVariable = parserVariableMatch[1];
2109
2305
  cliSource += `
@@ -2169,26 +2365,38 @@ if (process.argv.includes('serve')) {
2169
2365
  }
2170
2366
  `;
2171
2367
  } else {
2172
- console.warn("⚠ Could not find ArgParser instance in CLI source, MCP server may not work properly");
2368
+ console.warn(
2369
+ "⚠ Could not find ArgParser instance in CLI source, MCP server may not work properly"
2370
+ );
2173
2371
  }
2174
2372
  const serverDir = path__namespace.join(buildDir, "server");
2175
2373
  if (!fs__namespace.existsSync(serverDir)) {
2176
2374
  fs__namespace.mkdirSync(serverDir, { recursive: true });
2177
2375
  }
2178
2376
  fs__namespace.writeFileSync(path__namespace.join(serverDir, "original-cli.mjs"), cliSource);
2179
- console.log(`✓ Added original CLI source to build folder: ${path__namespace.basename(cliSourcePath)}`);
2377
+ console.log(
2378
+ `✓ Added original CLI source to build folder: ${path__namespace.basename(cliSourcePath)}`
2379
+ );
2180
2380
  } else {
2181
- console.warn("⚠ Original CLI source not found, handlers may not work properly");
2182
- console.warn(" Searched for:", possibleCliFiles.map((f) => path__namespace.basename(f)).join(", "));
2381
+ console.warn(
2382
+ " Original CLI source not found, handlers may not work properly"
2383
+ );
2384
+ console.warn(
2385
+ " Searched for:",
2386
+ possibleCliFiles.map((f) => path__namespace.basename(f)).join(", ")
2387
+ );
2183
2388
  }
2184
2389
  } catch (error) {
2185
- console.warn("⚠ Failed to add original CLI source:", error instanceof Error ? error.message : String(error));
2390
+ console.warn(
2391
+ "⚠ Failed to add original CLI source:",
2392
+ error instanceof Error ? error.message : String(error)
2393
+ );
2186
2394
  }
2187
2395
  }
2188
2396
  /**
2189
2397
  * Builds a complete DXT package using TSDown CLI for autonomous execution
2190
2398
  */
2191
- async buildDxtWithTsdown(entryPointFile) {
2399
+ async buildDxtWithTsdown(entryPointFile, outputDir = "./dxt") {
2192
2400
  try {
2193
2401
  console.log(simpleChalk.cyan("🔧 Building DXT package with TSDown..."));
2194
2402
  const entryDir = path__namespace.dirname(entryPointFile);
@@ -2206,7 +2414,7 @@ if (process.argv.includes('serve')) {
2206
2414
  console.log(simpleChalk.gray(`Building with TSDown: ${entryFileName}`));
2207
2415
  const buildConfig = {
2208
2416
  entry: [entryFileName],
2209
- outDir: "dxt",
2417
+ outDir: path__namespace.resolve(process.cwd(), outputDir),
2210
2418
  format: ["esm"],
2211
2419
  target: "node22",
2212
2420
  noExternal: () => true,
@@ -2219,13 +2427,35 @@ if (process.argv.includes('serve')) {
2219
2427
  ...(() => {
2220
2428
  const possibleLogoPaths = [
2221
2429
  // From built library assets
2222
- path__namespace.join(path__namespace.dirname(new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href).pathname), "..", "assets", "logo_1_small.jpg"),
2430
+ path__namespace.join(
2431
+ path__namespace.dirname(new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href).pathname),
2432
+ "..",
2433
+ "assets",
2434
+ "logo_1_small.jpg"
2435
+ ),
2223
2436
  // From node_modules
2224
- path__namespace.join(process.cwd(), "node_modules", "@alcyone-labs", "arg-parser", "dist", "assets", "logo_1_small.jpg"),
2437
+ path__namespace.join(
2438
+ process.cwd(),
2439
+ "node_modules",
2440
+ "@alcyone-labs",
2441
+ "arg-parser",
2442
+ "dist",
2443
+ "assets",
2444
+ "logo_1_small.jpg"
2445
+ ),
2225
2446
  // From package root dist/assets (for local build)
2226
2447
  path__namespace.join(process.cwd(), "dist", "assets", "logo_1_small.jpg"),
2227
2448
  // From library root (development)
2228
- path__namespace.join(process.cwd(), "..", "..", "..", "docs", "MCP", "icons", "logo_1_small.jpg")
2449
+ path__namespace.join(
2450
+ process.cwd(),
2451
+ "..",
2452
+ "..",
2453
+ "..",
2454
+ "docs",
2455
+ "MCP",
2456
+ "icons",
2457
+ "logo_1_small.jpg"
2458
+ )
2229
2459
  ];
2230
2460
  for (const logoPath of possibleLogoPaths) {
2231
2461
  if (fs__namespace.existsSync(logoPath)) {
@@ -2233,7 +2463,9 @@ if (process.argv.includes('serve')) {
2233
2463
  return [{ from: logoPath, to: "logo.jpg" }];
2234
2464
  }
2235
2465
  }
2236
- console.log(simpleChalk.yellow("⚠ Logo not found in any expected location"));
2466
+ console.log(
2467
+ simpleChalk.yellow("⚠ Logo not found in any expected location")
2468
+ );
2237
2469
  return [];
2238
2470
  })()
2239
2471
  ],
@@ -2273,20 +2505,39 @@ export default ${JSON.stringify(buildConfig, null, 2)};
2273
2505
  // To run manually:
2274
2506
  // npx tsdown -c tsdown.config.dxt.ts
2275
2507
  `;
2276
- fs__namespace.writeFileSync(path__namespace.join("dxt", "tsdown.config.dxt.ts"), configContent);
2277
- console.log(simpleChalk.gray("📝 Debug config written to dxt/tsdown.config.dxt.ts"));
2508
+ fs__namespace.writeFileSync(
2509
+ path__namespace.join("dxt", "tsdown.config.dxt.ts"),
2510
+ configContent
2511
+ );
2512
+ console.log(
2513
+ simpleChalk.gray("📝 Debug config written to dxt/tsdown.config.dxt.ts")
2514
+ );
2278
2515
  }
2279
2516
  await build(buildConfig);
2280
2517
  console.log(simpleChalk.green("✅ TSDown bundling completed"));
2281
- await this.copyLogoManually();
2282
- await this.setupDxtPackageFiles(entryPointFile);
2518
+ const actualOutputFilename = this.detectTsdownOutputFile(
2519
+ outputDir,
2520
+ entryFileName
2521
+ );
2522
+ await this.copyLogoManually(outputDir);
2523
+ await this.setupDxtPackageFiles(
2524
+ entryPointFile,
2525
+ outputDir,
2526
+ actualOutputFilename ?? void 0
2527
+ );
2283
2528
  console.log(simpleChalk.cyan("📦 DXT package ready for packing"));
2284
- console.log(simpleChalk.gray("To complete the process, run: npx @anthropic-ai/dxt pack dxt/"));
2529
+ console.log(
2530
+ simpleChalk.gray(
2531
+ `To complete the process, run: npx @anthropic-ai/dxt pack ${outputDir}/`
2532
+ )
2533
+ );
2285
2534
  } finally {
2286
2535
  process.chdir(originalCwd);
2287
2536
  }
2288
2537
  } catch (error) {
2289
- throw new Error(`TSDown DXT build failed: ${error instanceof Error ? error.message : String(error)}`);
2538
+ throw new Error(
2539
+ `TSDown DXT build failed: ${error instanceof Error ? error.message : String(error)}`
2540
+ );
2290
2541
  }
2291
2542
  }
2292
2543
  /**
@@ -2295,13 +2546,17 @@ export default ${JSON.stringify(buildConfig, null, 2)};
2295
2546
  async bundleOriginalCliWithTsdown(serverDir) {
2296
2547
  try {
2297
2548
  const { build } = await import("tsdown");
2298
- console.log(simpleChalk.cyan("🔧 Bundling CLI with TSDown for autonomous execution..."));
2549
+ console.log(
2550
+ simpleChalk.cyan("🔧 Bundling CLI with TSDown for autonomous execution...")
2551
+ );
2299
2552
  const configContent = this.getTsdownConfigContent();
2300
2553
  const localConfigPath = path__namespace.join(serverDir, "tsdown.config.mjs");
2301
2554
  fs__namespace.writeFileSync(localConfigPath, configContent);
2302
2555
  const originalCliPath = path__namespace.join(serverDir, "original-cli.mjs");
2303
2556
  if (!fs__namespace.existsSync(originalCliPath)) {
2304
- console.warn(simpleChalk.yellow("⚠ Original CLI not found, skipping TSDown bundling"));
2557
+ console.warn(
2558
+ simpleChalk.yellow("⚠ Original CLI not found, skipping TSDown bundling")
2559
+ );
2305
2560
  return null;
2306
2561
  }
2307
2562
  const buildOptions = {
@@ -2322,7 +2577,10 @@ export default ${JSON.stringify(buildConfig, null, 2)};
2322
2577
  outExtension: () => ({ js: ".bundled.mjs" }),
2323
2578
  alias: {
2324
2579
  // Alias chalk to SimpleChalk for autonomous builds
2325
- chalk: path__namespace.resolve(process.cwd(), "node_modules/@alcyone-labs/arg-parser/dist/SimpleChalk.mjs")
2580
+ chalk: path__namespace.resolve(
2581
+ process.cwd(),
2582
+ "node_modules/@alcyone-labs/arg-parser/dist/SimpleChalk.mjs"
2583
+ )
2326
2584
  },
2327
2585
  external: [
2328
2586
  // Only Node.js built-ins - everything else gets bundled for true autonomy
@@ -2414,8 +2672,15 @@ export default ${JSON.stringify(buildConfig, null, 2)};
2414
2672
  }
2415
2673
  }
2416
2674
  if (bundledPath && bundledFileName) {
2417
- console.log(simpleChalk.green(`✅ TSDown bundling completed successfully: ${bundledFileName}`));
2418
- const expectedBundledPath = path__namespace.join(serverDir, "original-cli.bundled.mjs");
2675
+ console.log(
2676
+ simpleChalk.green(
2677
+ `✅ TSDown bundling completed successfully: ${bundledFileName}`
2678
+ )
2679
+ );
2680
+ const expectedBundledPath = path__namespace.join(
2681
+ serverDir,
2682
+ "original-cli.bundled.mjs"
2683
+ );
2419
2684
  if (bundledPath !== expectedBundledPath) {
2420
2685
  fs__namespace.renameSync(bundledPath, expectedBundledPath);
2421
2686
  bundledFileName = "original-cli.bundled.mjs";
@@ -2427,15 +2692,24 @@ export default ${JSON.stringify(buildConfig, null, 2)};
2427
2692
  try {
2428
2693
  fs__namespace.chmodSync(expectedBundledPath, 493);
2429
2694
  } catch (error) {
2430
- console.warn("⚠ Could not set executable permission on bundled file:", error instanceof Error ? error.message : String(error));
2695
+ console.warn(
2696
+ "⚠ Could not set executable permission on bundled file:",
2697
+ error instanceof Error ? error.message : String(error)
2698
+ );
2431
2699
  }
2432
2700
  return bundledFileName;
2433
2701
  } else {
2434
- console.warn(simpleChalk.yellow("⚠ TSDown bundling failed, bundled file not found"));
2702
+ console.warn(
2703
+ simpleChalk.yellow("⚠ TSDown bundling failed, bundled file not found")
2704
+ );
2435
2705
  return null;
2436
2706
  }
2437
2707
  } catch (error) {
2438
- console.warn(simpleChalk.yellow(`⚠ TSDown bundling failed: ${error instanceof Error ? error.message : String(error)}`));
2708
+ console.warn(
2709
+ simpleChalk.yellow(
2710
+ `⚠ TSDown bundling failed: ${error instanceof Error ? error.message : String(error)}`
2711
+ )
2712
+ );
2439
2713
  console.log(simpleChalk.gray(" Falling back to non-bundled approach"));
2440
2714
  return null;
2441
2715
  }
@@ -2490,22 +2764,44 @@ export default ${JSON.stringify(buildConfig, null, 2)};
2490
2764
  */
2491
2765
  getTsdownConfigContent() {
2492
2766
  const currentDir = path__namespace.dirname(new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href).pathname);
2493
- const assetsConfigPath = path__namespace.join(currentDir, "..", "assets", "tsdown.dxt.config.ts");
2767
+ const assetsConfigPath = path__namespace.join(
2768
+ currentDir,
2769
+ "..",
2770
+ "assets",
2771
+ "tsdown.dxt.config.ts"
2772
+ );
2494
2773
  if (fs__namespace.existsSync(assetsConfigPath)) {
2495
2774
  try {
2496
2775
  const content = fs__namespace.readFileSync(assetsConfigPath, "utf-8");
2497
- return content.replace('/// <reference types="tsdown" />', "").replace('import { defineConfig } from "tsdown/config";', 'import { defineConfig } from "tsdown";').replace("export default defineConfig(", "export default defineConfig(");
2776
+ return content.replace('/// <reference types="tsdown" />', "").replace(
2777
+ 'import { defineConfig } from "tsdown/config";',
2778
+ 'import { defineConfig } from "tsdown";'
2779
+ ).replace(
2780
+ "export default defineConfig(",
2781
+ "export default defineConfig("
2782
+ );
2498
2783
  } catch (error) {
2499
- console.warn(simpleChalk.yellow("⚠ Could not read TSDown config from assets, using fallback"));
2784
+ console.warn(
2785
+ simpleChalk.yellow(
2786
+ "⚠ Could not read TSDown config from assets, using fallback"
2787
+ )
2788
+ );
2500
2789
  }
2501
2790
  }
2502
2791
  const rootConfigPath = path__namespace.join(process.cwd(), "tsdown.dxt.config.ts");
2503
2792
  if (fs__namespace.existsSync(rootConfigPath)) {
2504
2793
  try {
2505
2794
  const content = fs__namespace.readFileSync(rootConfigPath, "utf-8");
2506
- return content.replace('/// <reference types="tsdown" />', "").replace('import { defineConfig } from "tsdown/config";', 'import { defineConfig } from "tsdown";');
2795
+ return content.replace('/// <reference types="tsdown" />', "").replace(
2796
+ 'import { defineConfig } from "tsdown/config";',
2797
+ 'import { defineConfig } from "tsdown";'
2798
+ );
2507
2799
  } catch (error) {
2508
- console.warn(simpleChalk.yellow("⚠ Could not read TSDown config from root, using default"));
2800
+ console.warn(
2801
+ simpleChalk.yellow(
2802
+ "⚠ Could not read TSDown config from root, using default"
2803
+ )
2804
+ );
2509
2805
  }
2510
2806
  }
2511
2807
  return `import { defineConfig } from "tsdown";
@@ -2536,9 +2832,22 @@ export default defineConfig({
2536
2832
  getDxtIgnoreTemplatePath() {
2537
2833
  const possiblePaths = [
2538
2834
  // 1. From the built library assets (when installed via npm)
2539
- path__namespace.join(path__namespace.dirname(new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href).pathname), "..", "assets", ".dxtignore.template"),
2835
+ path__namespace.join(
2836
+ path__namespace.dirname(new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href).pathname),
2837
+ "..",
2838
+ "assets",
2839
+ ".dxtignore.template"
2840
+ ),
2540
2841
  // 2. From node_modules/@alcyone-labs/arg-parser/dist/assets (when installed via npm)
2541
- path__namespace.join(process.cwd(), "node_modules", "@alcyone-labs", "arg-parser", "dist", "assets", ".dxtignore.template"),
2842
+ path__namespace.join(
2843
+ process.cwd(),
2844
+ "node_modules",
2845
+ "@alcyone-labs",
2846
+ "arg-parser",
2847
+ "dist",
2848
+ "assets",
2849
+ ".dxtignore.template"
2850
+ ),
2542
2851
  // 3. From the root directory (development/local build)
2543
2852
  path__namespace.join(process.cwd(), ".dxtignore.template"),
2544
2853
  // 4. From the library root (when using local file dependency)
@@ -2554,13 +2863,13 @@ export default defineConfig({
2554
2863
  return "";
2555
2864
  }
2556
2865
  /**
2557
- * Sets up DXT package files (manifest.json) in the dxt output directory
2866
+ * Sets up DXT package files (manifest.json) in the output directory
2558
2867
  */
2559
- async setupDxtPackageFiles(entryPointFile) {
2868
+ async setupDxtPackageFiles(entryPointFile, outputDir = "./dxt", actualOutputFilename) {
2560
2869
  var _a, _b, _c, _d, _e;
2561
- const dxtDir = "./dxt";
2870
+ const dxtDir = path__namespace.resolve(process.cwd(), outputDir);
2562
2871
  if (!fs__namespace.existsSync(dxtDir)) {
2563
- throw new Error("TSDown output directory (dxt) not found");
2872
+ throw new Error(`TSDown output directory (${outputDir}) not found`);
2564
2873
  }
2565
2874
  const packageJsonPath = path__namespace.join(process.cwd(), "package.json");
2566
2875
  let packageInfo = {};
@@ -2579,7 +2888,11 @@ export default defineConfig({
2579
2888
  description: tool.description
2580
2889
  }));
2581
2890
  } catch (error) {
2582
- console.warn(simpleChalk.yellow(`Warning: Could not generate unified tool list: ${error instanceof Error ? error.message : String(error)}`));
2891
+ console.warn(
2892
+ simpleChalk.yellow(
2893
+ `Warning: Could not generate unified tool list: ${error instanceof Error ? error.message : String(error)}`
2894
+ )
2895
+ );
2583
2896
  const mainFlags2 = this.argParserInstance.flags;
2584
2897
  const properties2 = {};
2585
2898
  const required2 = [];
@@ -2600,10 +2913,12 @@ export default defineConfig({
2600
2913
  }
2601
2914
  }
2602
2915
  const commandName = this.argParserInstance.getAppCommandName();
2603
- tools = [{
2604
- name: commandName || packageInfo.name || "cli-tool",
2605
- description: packageInfo.description || this.argParserInstance.getDescription() || "CLI tool"
2606
- }];
2916
+ tools = [
2917
+ {
2918
+ name: commandName || packageInfo.name || "cli-tool",
2919
+ description: packageInfo.description || this.argParserInstance.getDescription() || "CLI tool"
2920
+ }
2921
+ ];
2607
2922
  }
2608
2923
  const envVars = {};
2609
2924
  const userConfig = {};
@@ -2645,7 +2960,18 @@ export default defineConfig({
2645
2960
  }
2646
2961
  }
2647
2962
  const serverInfo = this.extractMcpServerInfo();
2648
- const entryFileName = path__namespace.basename(entryPointFile);
2963
+ let logoFilename = "logo.jpg";
2964
+ if (serverInfo == null ? void 0 : serverInfo.logo) {
2965
+ const customLogoFilename = await this.addLogoToFolder(
2966
+ dxtDir,
2967
+ serverInfo,
2968
+ entryPointFile
2969
+ );
2970
+ if (customLogoFilename) {
2971
+ logoFilename = customLogoFilename;
2972
+ }
2973
+ }
2974
+ const entryFileName = actualOutputFilename || path__namespace.basename(entryPointFile).replace(/\.ts$/, ".js");
2649
2975
  const manifest = {
2650
2976
  dxt_version: "0.1",
2651
2977
  name: serverInfo.name || packageInfo.name || "mcp-server",
@@ -2661,15 +2987,12 @@ export default defineConfig({
2661
2987
  entry_point: entryFileName,
2662
2988
  mcp_config: {
2663
2989
  command: "node",
2664
- args: [
2665
- `\${__dirname}/${entryFileName}`,
2666
- "--s-mcp-serve"
2667
- ],
2990
+ args: [`\${__dirname}/${entryFileName}`, "--s-mcp-serve"],
2668
2991
  env: envVars
2669
2992
  }
2670
2993
  },
2671
2994
  tools,
2672
- icon: "logo.jpg",
2995
+ icon: logoFilename,
2673
2996
  ...Object.keys(userConfig).length > 0 && { user_config: userConfig },
2674
2997
  repository: {
2675
2998
  type: "git",
@@ -2677,27 +3000,56 @@ export default defineConfig({
2677
3000
  },
2678
3001
  license: packageInfo.license || "MIT"
2679
3002
  };
2680
- fs__namespace.writeFileSync(path__namespace.join(dxtDir, "manifest.json"), JSON.stringify(manifest, null, 2));
3003
+ fs__namespace.writeFileSync(
3004
+ path__namespace.join(dxtDir, "manifest.json"),
3005
+ JSON.stringify(manifest, null, 2)
3006
+ );
2681
3007
  console.log(simpleChalk.gray("✅ DXT package files set up"));
2682
3008
  }
2683
3009
  /**
2684
3010
  * Manually copy logo since TSDown's copy option doesn't work programmatically
2685
3011
  */
2686
- async copyLogoManually() {
2687
- const dxtDir = "./dxt";
3012
+ async copyLogoManually(outputDir = "./dxt") {
3013
+ const dxtDir = path__namespace.resolve(process.cwd(), outputDir);
2688
3014
  if (!fs__namespace.existsSync(dxtDir)) {
2689
- console.warn(simpleChalk.yellow("⚠ DXT directory not found, skipping logo copy"));
3015
+ console.warn(
3016
+ simpleChalk.yellow(
3017
+ `⚠ Output directory (${outputDir}) not found, skipping logo copy`
3018
+ )
3019
+ );
2690
3020
  return;
2691
3021
  }
2692
3022
  const possibleLogoPaths = [
2693
3023
  // From built library assets
2694
- path__namespace.join(path__namespace.dirname(new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href).pathname), "..", "assets", "logo_1_small.jpg"),
3024
+ path__namespace.join(
3025
+ path__namespace.dirname(new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href).pathname),
3026
+ "..",
3027
+ "assets",
3028
+ "logo_1_small.jpg"
3029
+ ),
2695
3030
  // From node_modules
2696
- path__namespace.join(process.cwd(), "node_modules", "@alcyone-labs", "arg-parser", "dist", "assets", "logo_1_small.jpg"),
3031
+ path__namespace.join(
3032
+ process.cwd(),
3033
+ "node_modules",
3034
+ "@alcyone-labs",
3035
+ "arg-parser",
3036
+ "dist",
3037
+ "assets",
3038
+ "logo_1_small.jpg"
3039
+ ),
2697
3040
  // From package root dist/assets (for local build)
2698
3041
  path__namespace.join(process.cwd(), "dist", "assets", "logo_1_small.jpg"),
2699
3042
  // From library root (development)
2700
- path__namespace.join(process.cwd(), "..", "..", "..", "docs", "MCP", "icons", "logo_1_small.jpg")
3043
+ path__namespace.join(
3044
+ process.cwd(),
3045
+ "..",
3046
+ "..",
3047
+ "..",
3048
+ "docs",
3049
+ "MCP",
3050
+ "icons",
3051
+ "logo_1_small.jpg"
3052
+ )
2701
3053
  ];
2702
3054
  for (const logoPath of possibleLogoPaths) {
2703
3055
  if (fs__namespace.existsSync(logoPath)) {
@@ -2706,12 +3058,78 @@ export default defineConfig({
2706
3058
  console.log(simpleChalk.gray(`✅ Logo copied from: ${logoPath}`));
2707
3059
  return;
2708
3060
  } catch (error) {
2709
- console.warn(simpleChalk.yellow(`⚠ Failed to copy logo from ${logoPath}: ${error}`));
3061
+ console.warn(
3062
+ simpleChalk.yellow(`⚠ Failed to copy logo from ${logoPath}: ${error}`)
3063
+ );
2710
3064
  }
2711
3065
  }
2712
3066
  }
2713
3067
  console.warn(simpleChalk.yellow("⚠ Logo not found in any expected location"));
2714
3068
  }
3069
+ /**
3070
+ * Detects the actual output filename generated by TSDown
3071
+ */
3072
+ detectTsdownOutputFile(outputDir, expectedBaseName) {
3073
+ try {
3074
+ const dxtDir = path__namespace.resolve(process.cwd(), outputDir);
3075
+ if (!fs__namespace.existsSync(dxtDir)) {
3076
+ console.warn(
3077
+ simpleChalk.yellow(`⚠ Output directory (${outputDir}) not found`)
3078
+ );
3079
+ return null;
3080
+ }
3081
+ const files = fs__namespace.readdirSync(dxtDir).filter(
3082
+ (file) => (file.endsWith(".js") || file.endsWith(".mjs")) && !file.includes("chunk-") && !file.includes("dist-") && !file.startsWith(".")
3083
+ );
3084
+ const baseNameWithoutExt = path__namespace.parse(expectedBaseName).name;
3085
+ for (const ext of [".js", ".mjs"]) {
3086
+ const exactMatch = `${baseNameWithoutExt}${ext}`;
3087
+ if (files.includes(exactMatch)) {
3088
+ console.log(simpleChalk.gray(`✓ Detected TSDown output: ${exactMatch}`));
3089
+ return exactMatch;
3090
+ }
3091
+ }
3092
+ const mainFiles = files.filter(
3093
+ (file) => !file.includes("chunk") && !file.includes("dist") && file !== "logo.jpg" && file !== "manifest.json"
3094
+ );
3095
+ if (mainFiles.length === 1) {
3096
+ console.log(simpleChalk.gray(`✓ Detected TSDown output: ${mainFiles[0]}`));
3097
+ return mainFiles[0];
3098
+ }
3099
+ if (mainFiles.length > 1) {
3100
+ let bestMatch = mainFiles[0];
3101
+ let bestScore = 0;
3102
+ for (const file of mainFiles) {
3103
+ const filePath = path__namespace.join(dxtDir, file);
3104
+ const stats = fs__namespace.statSync(filePath);
3105
+ const nameScore = file.includes(baseNameWithoutExt) ? 100 : 0;
3106
+ const sizeScore = Math.min(stats.size / 1e3, 50);
3107
+ const totalScore = nameScore + sizeScore;
3108
+ if (totalScore > bestScore) {
3109
+ bestScore = totalScore;
3110
+ bestMatch = file;
3111
+ }
3112
+ }
3113
+ console.log(
3114
+ simpleChalk.gray(
3115
+ `✓ Detected TSDown output: ${bestMatch} (best match from ${mainFiles.length} candidates)`
3116
+ )
3117
+ );
3118
+ return bestMatch;
3119
+ }
3120
+ console.warn(
3121
+ simpleChalk.yellow(`⚠ Could not detect TSDown output file in ${outputDir}`)
3122
+ );
3123
+ return null;
3124
+ } catch (error) {
3125
+ console.warn(
3126
+ simpleChalk.yellow(
3127
+ `⚠ Error detecting TSDown output: ${error instanceof Error ? error.message : String(error)}`
3128
+ )
3129
+ );
3130
+ return null;
3131
+ }
3132
+ }
2715
3133
  }
2716
3134
  class McpNotificationsManager {
2717
3135
  constructor() {
@@ -2865,10 +3283,16 @@ class McpNotificationsManager {
2865
3283
  sendNotificationToClient(client, type2) {
2866
3284
  try {
2867
3285
  if (client.connection && typeof client.connection.sendNotification === "function") {
2868
- client.connection.sendNotification(`notifications/${type2}/list_changed`, {});
3286
+ client.connection.sendNotification(
3287
+ `notifications/${type2}/list_changed`,
3288
+ {}
3289
+ );
2869
3290
  }
2870
3291
  } catch (error) {
2871
- console.error(`Error sending notification to client ${client.clientId}:`, error);
3292
+ console.error(
3293
+ `Error sending notification to client ${client.clientId}:`,
3294
+ error
3295
+ );
2872
3296
  this.removeClient(client.clientId);
2873
3297
  }
2874
3298
  }
@@ -2957,7 +3381,9 @@ class McpPromptsManager {
2957
3381
  return await entry.config.handler(validatedArgs);
2958
3382
  } catch (error) {
2959
3383
  if (error instanceof zod.z.ZodError) {
2960
- throw new Error(`Invalid arguments for prompt '${name}': ${error.message}`);
3384
+ throw new Error(
3385
+ `Invalid arguments for prompt '${name}': ${error.message}`
3386
+ );
2961
3387
  }
2962
3388
  throw error;
2963
3389
  }
@@ -3157,7 +3583,9 @@ class McpResourcesManager {
3157
3583
  try {
3158
3584
  new ResourceTemplateParser(config.uriTemplate);
3159
3585
  } catch (error) {
3160
- throw new Error(`Invalid URI template '${config.uriTemplate}': ${error instanceof Error ? error.message : String(error)}`);
3586
+ throw new Error(
3587
+ `Invalid URI template '${config.uriTemplate}': ${error instanceof Error ? error.message : String(error)}`
3588
+ );
3161
3589
  }
3162
3590
  }
3163
3591
  /**
@@ -3262,6 +3690,97 @@ const _FlagManager = class _FlagManager {
3262
3690
  __flags = new WeakMap();
3263
3691
  _throwForDuplicateFlags = new WeakMap();
3264
3692
  let FlagManager = _FlagManager;
3693
+ function detectEntryPoint() {
3694
+ try {
3695
+ if (process.argv[1] && fs__namespace.existsSync(process.argv[1])) {
3696
+ return process.argv[1];
3697
+ }
3698
+ if (typeof require !== "undefined" && require.main && require.main.filename) {
3699
+ return require.main.filename;
3700
+ }
3701
+ return null;
3702
+ } catch {
3703
+ return null;
3704
+ }
3705
+ }
3706
+ function getEntryPointFromImportMeta(importMetaUrl) {
3707
+ if (importMetaUrl.startsWith("file://")) {
3708
+ return decodeURIComponent(importMetaUrl.replace("file://", ""));
3709
+ }
3710
+ return importMetaUrl;
3711
+ }
3712
+ function normalizePath(path2) {
3713
+ return path2.trim();
3714
+ }
3715
+ function resolveLogPath(logPath, fallbackEntryPoint) {
3716
+ if (typeof logPath === "string") {
3717
+ const normalizedPath2 = normalizePath(logPath);
3718
+ if (path__namespace.isAbsolute(normalizedPath2)) {
3719
+ return normalizedPath2;
3720
+ }
3721
+ if (normalizedPath2.startsWith("cwd:")) {
3722
+ const relativePath = normalizedPath2.slice(4);
3723
+ return path__namespace.resolve(process.cwd(), relativePath);
3724
+ }
3725
+ const entryPoint = detectEntryPoint() || fallbackEntryPoint;
3726
+ if (entryPoint) {
3727
+ return path__namespace.resolve(path__namespace.dirname(entryPoint), normalizedPath2);
3728
+ }
3729
+ console.warn(
3730
+ `Warning: Could not detect entry point for log path resolution. Using process.cwd() as fallback. Path: ${normalizedPath2}`
3731
+ );
3732
+ return path__namespace.resolve(process.cwd(), normalizedPath2);
3733
+ }
3734
+ const { path: logFilePath, relativeTo = "entry", basePath } = logPath;
3735
+ const normalizedPath = normalizePath(logFilePath);
3736
+ switch (relativeTo) {
3737
+ case "absolute":
3738
+ if (basePath) {
3739
+ return path__namespace.resolve(basePath, normalizedPath);
3740
+ }
3741
+ if (path__namespace.isAbsolute(normalizedPath)) {
3742
+ return normalizedPath;
3743
+ }
3744
+ console.warn(
3745
+ `Warning: relativeTo 'absolute' specified but no basePath provided and path is not absolute. Using process.cwd() as fallback. Path: ${normalizedPath}`
3746
+ );
3747
+ return path__namespace.resolve(process.cwd(), normalizedPath);
3748
+ case "cwd":
3749
+ return path__namespace.resolve(process.cwd(), normalizedPath);
3750
+ case "entry":
3751
+ default:
3752
+ const entryPoint = detectEntryPoint() || fallbackEntryPoint;
3753
+ if (entryPoint) {
3754
+ return path__namespace.resolve(path__namespace.dirname(entryPoint), normalizedPath);
3755
+ }
3756
+ console.warn(
3757
+ `Warning: Could not detect entry point for log path resolution. Using process.cwd() as fallback. Path: ${normalizedPath}`
3758
+ );
3759
+ return path__namespace.resolve(process.cwd(), normalizedPath);
3760
+ }
3761
+ }
3762
+ function entryRelative(path2) {
3763
+ return {
3764
+ path: path2,
3765
+ relativeTo: "entry"
3766
+ };
3767
+ }
3768
+ function cwdRelative(path2) {
3769
+ return {
3770
+ path: path2,
3771
+ relativeTo: "cwd"
3772
+ };
3773
+ }
3774
+ function absolutePath(path2, basePath) {
3775
+ return {
3776
+ path: path2,
3777
+ relativeTo: "absolute",
3778
+ basePath
3779
+ };
3780
+ }
3781
+ function legacyCwdPath(path2) {
3782
+ return `cwd:${path2}`;
3783
+ }
3265
3784
  class ArgParserError extends Error {
3266
3785
  constructor(message, cmdChain = []) {
3267
3786
  super(message);
@@ -3390,7 +3909,7 @@ const _ArgParserBase = class _ArgParserBase {
3390
3909
  getSubCommands() {
3391
3910
  return __privateGet(this, _subCommands);
3392
3911
  }
3393
- _addToOutput(flag, arg, output, _parseOptions) {
3912
+ async _addToOutput(flag, arg, output, _parseOptions) {
3394
3913
  let value = arg;
3395
3914
  if (flag["type"] === Boolean) {
3396
3915
  if (typeof arg === "boolean") {
@@ -3401,7 +3920,8 @@ const _ArgParserBase = class _ArgParserBase {
3401
3920
  value = new flag["type"](value);
3402
3921
  }
3403
3922
  } else if (typeof flag["type"] === "function") {
3404
- value = flag["type"](value);
3923
+ const result = flag["type"](value);
3924
+ value = result && typeof result.then === "function" ? await result : result;
3405
3925
  } else if (typeof flag["type"] === "object") {
3406
3926
  value = new flag["type"](value);
3407
3927
  }
@@ -3514,7 +4034,26 @@ const _ArgParserBase = class _ArgParserBase {
3514
4034
  }
3515
4035
  }
3516
4036
  async parse(processArgs, options) {
3517
- var _a;
4037
+ var _a, _b;
4038
+ if (processArgs === void 0) {
4039
+ if (typeof process !== "undefined" && process.argv && Array.isArray(process.argv)) {
4040
+ processArgs = process.argv.slice(2);
4041
+ const isCliMode = !__privateGet(this, _parentParser) && !!__privateGet(this, _appCommandName);
4042
+ const isMcpMode = (options == null ? void 0 : options.isMcp) || ((_a = globalThis.console) == null ? void 0 : _a.mcpError);
4043
+ if (isCliMode && !isMcpMode) {
4044
+ console.warn(
4045
+ `Warning: parse() called without arguments. Auto-detected Node.js environment and using process.argv.slice(2).`
4046
+ );
4047
+ console.warn(
4048
+ `For explicit control, call parse(process.argv.slice(2)) instead.`
4049
+ );
4050
+ }
4051
+ } else {
4052
+ throw new Error(
4053
+ "parse() called without arguments in non-Node.js environment. Please provide arguments explicitly: parse(['--flag', 'value'])"
4054
+ );
4055
+ }
4056
+ }
3518
4057
  const originalProcessArgs = [...processArgs];
3519
4058
  const shouldPreventExecution = typeof process !== "undefined" && (process.env["ARGPARSER_FUZZY_MODE"] === "true" || process.argv && process.argv.includes("--s-enable-fuzzy") && !processArgs.includes("--s-enable-fuzzy")) && !(options == null ? void 0 : options.skipHelpHandling);
3520
4059
  if (shouldPreventExecution) {
@@ -3533,11 +4072,11 @@ const _ArgParserBase = class _ArgParserBase {
3533
4072
  commandChain: identifiedCommandChain,
3534
4073
  parserChain: identifiedParserChain
3535
4074
  } = __privateMethod(this, _ArgParserBase_instances, _identifyCommandChainAndParsers_fn).call(this, processArgs, this, [], [this]);
3536
- const saveToEnvResult = __privateMethod(_a = identifiedFinalParser, _ArgParserBase_instances, _handleSaveToEnvFlag_fn).call(_a, processArgs, identifiedParserChain);
4075
+ const saveToEnvResult = __privateMethod(_b = identifiedFinalParser, _ArgParserBase_instances, _handleSaveToEnvFlag_fn).call(_b, processArgs, identifiedParserChain);
3537
4076
  if (saveToEnvResult !== false) {
3538
4077
  return saveToEnvResult === true ? {} : saveToEnvResult;
3539
4078
  }
3540
- const { finalArgs, handlerToExecute } = this._parseRecursive(
4079
+ const { finalArgs, handlerToExecute } = await this._parseRecursive(
3541
4080
  processArgs,
3542
4081
  this,
3543
4082
  {},
@@ -3601,7 +4140,7 @@ const _ArgParserBase = class _ArgParserBase {
3601
4140
  * Recursive helper for parsing arguments and handling sub-commands.
3602
4141
  * This method assumes the global help check has already been performed in `parse`.
3603
4142
  */
3604
- _parseRecursive(argsToParse, currentParser, accumulatedParentArgs, commandChainSoFar, options, parentParser) {
4143
+ async _parseRecursive(argsToParse, currentParser, accumulatedParentArgs, commandChainSoFar, options, parentParser) {
3605
4144
  var _a, _b;
3606
4145
  let subCommandIndex = -1;
3607
4146
  let subCommandName = null;
@@ -3614,7 +4153,7 @@ const _ArgParserBase = class _ArgParserBase {
3614
4153
  }
3615
4154
  }
3616
4155
  const argsForCurrentLevel = subCommandIndex === -1 ? argsToParse : argsToParse.slice(0, subCommandIndex);
3617
- const { parsedArgs: currentLevelArgs, firstUnconsumedIndex } = __privateMethod(_a = currentParser, _ArgParserBase_instances, parseFlags_fn).call(_a, argsForCurrentLevel, options);
4156
+ const { parsedArgs: currentLevelArgs, firstUnconsumedIndex } = await __privateMethod(_a = currentParser, _ArgParserBase_instances, parseFlags_fn).call(_a, argsForCurrentLevel, options);
3618
4157
  __privateMethod(_b = currentParser, _ArgParserBase_instances, _applyDefaultValues_fn).call(_b, currentLevelArgs, currentParser);
3619
4158
  const combinedArgsFromThisAndParents = {
3620
4159
  ...accumulatedParentArgs,
@@ -3668,7 +4207,7 @@ const _ArgParserBase = class _ArgParserBase {
3668
4207
  ...accumulatedParentArgs,
3669
4208
  ...currentLevelArgs
3670
4209
  };
3671
- return this._parseRecursive(
4210
+ return await this._parseRecursive(
3672
4211
  nextArgs,
3673
4212
  nextParser,
3674
4213
  combinedArgsForNextLevel,
@@ -4071,7 +4610,7 @@ _handleGlobalChecks_fn = async function(processArgs, options) {
4071
4610
  const rootArgsSlice = rootSubCommandIndex === -1 ? remainingArgs : remainingArgs.slice(0, rootSubCommandIndex);
4072
4611
  parsingSteps.push({ level: "(root)", argsSlice: rootArgsSlice });
4073
4612
  try {
4074
- const { parsedArgs: rootParsedArgs } = __privateMethod(_a = currentParser, _ArgParserBase_instances, parseFlags_fn).call(_a, rootArgsSlice, { skipHelpHandling: true });
4613
+ const { parsedArgs: rootParsedArgs } = await __privateMethod(_a = currentParser, _ArgParserBase_instances, parseFlags_fn).call(_a, rootArgsSlice, { skipHelpHandling: true });
4075
4614
  parsingSteps[0].parsed = rootParsedArgs;
4076
4615
  accumulatedArgs = { ...accumulatedArgs, ...rootParsedArgs };
4077
4616
  } catch (e) {
@@ -4100,7 +4639,7 @@ _handleGlobalChecks_fn = async function(processArgs, options) {
4100
4639
  };
4101
4640
  parsingSteps.push(stepInfo);
4102
4641
  try {
4103
- const { parsedArgs: currentLevelParsedArgs } = __privateMethod(_c = currentParser, _ArgParserBase_instances, parseFlags_fn).call(_c, currentLevelArgsSlice, {
4642
+ const { parsedArgs: currentLevelParsedArgs } = await __privateMethod(_c = currentParser, _ArgParserBase_instances, parseFlags_fn).call(_c, currentLevelArgsSlice, {
4104
4643
  skipHelpHandling: true
4105
4644
  });
4106
4645
  stepInfo.parsed = currentLevelParsedArgs;
@@ -4286,7 +4825,7 @@ _prepareAndExecuteHandler_fn = function(handlerToExecute, finalArgs, skipHandler
4286
4825
  }
4287
4826
  }
4288
4827
  };
4289
- parseFlags_fn = function(args, options) {
4828
+ parseFlags_fn = async function(args, options) {
4290
4829
  var _a, _b;
4291
4830
  const flags = __privateGet(this, _flagManager).flags;
4292
4831
  const output = Object.fromEntries(
@@ -4309,7 +4848,7 @@ parseFlags_fn = function(args, options) {
4309
4848
  const itemToCheck = args[i];
4310
4849
  const matches = regex.exec(`${itemToCheck}`);
4311
4850
  if ((_a = matches == null ? void 0 : matches.groups) == null ? void 0 : _a["arg"]) {
4312
- this._addToOutput(
4851
+ await this._addToOutput(
4313
4852
  flagToCheck,
4314
4853
  (_b = matches == null ? void 0 : matches.groups) == null ? void 0 : _b["arg"],
4315
4854
  output,
@@ -4332,12 +4871,12 @@ parseFlags_fn = function(args, options) {
4332
4871
  if (flagToCheck["options"].includes(value)) {
4333
4872
  consumedIndices.add(index2);
4334
4873
  if (flagToCheck["flagOnly"]) {
4335
- this._addToOutput(flagToCheck, true, output, options);
4874
+ await this._addToOutput(flagToCheck, true, output, options);
4336
4875
  } else if (nextValueExists && !nextValueIsFlag) {
4337
- this._addToOutput(flagToCheck, nextValue, output, options);
4876
+ await this._addToOutput(flagToCheck, nextValue, output, options);
4338
4877
  consumedIndices.add(nextIndex);
4339
4878
  } else if (flagToCheck["type"] === Boolean) {
4340
- this._addToOutput(flagToCheck, true, output, options);
4879
+ await this._addToOutput(flagToCheck, true, output, options);
4341
4880
  }
4342
4881
  if (!flagToCheck["allowMultiple"]) break;
4343
4882
  }
@@ -4639,15 +5178,16 @@ _handleBuildDxtFlag_fn = async function(processArgs, buildDxtIndex) {
4639
5178
  };
4640
5179
  _handleMcpServeFlag_fn = async function(processArgs, _mcpServeIndex) {
4641
5180
  var _a;
5181
+ const transportOptions = __privateMethod(this, _ArgParserBase_instances, _parseMcpTransportOptions_fn).call(this, processArgs);
5182
+ const mcpServerConfig = __privateMethod(this, _ArgParserBase_instances, _getMcpServerConfiguration_fn).call(this);
5183
+ const effectiveLogPath = transportOptions.logPath || (mcpServerConfig == null ? void 0 : mcpServerConfig.logPath) || "./logs/mcp.log";
5184
+ const resolvedLogPath = resolveLogPath(effectiveLogPath);
4642
5185
  let mcpLogger;
4643
5186
  try {
4644
5187
  const mcpLoggerModule = await Function(
4645
5188
  'return import("@alcyone-labs/simple-mcp-logger")'
4646
5189
  )();
4647
- mcpLogger = mcpLoggerModule.createMcpLogger(
4648
- "MCP Serve",
4649
- "./logs/mcp.log"
4650
- );
5190
+ mcpLogger = mcpLoggerModule.createMcpLogger("MCP Serve", resolvedLogPath);
4651
5191
  globalThis.console = mcpLogger;
4652
5192
  } catch {
4653
5193
  mcpLogger = {
@@ -4658,7 +5198,6 @@ _handleMcpServeFlag_fn = async function(processArgs, _mcpServeIndex) {
4658
5198
  mcpLogger.mcpError(
4659
5199
  "Starting --s-mcp-serve system flag handler - console hijacked for MCP safety"
4660
5200
  );
4661
- const mcpServerConfig = __privateMethod(this, _ArgParserBase_instances, _getMcpServerConfiguration_fn).call(this);
4662
5201
  if (!mcpServerConfig) {
4663
5202
  mcpLogger.mcpError(
4664
5203
  "No MCP server configuration found. Use withMcp() or addMcpSubCommand() to configure MCP server."
@@ -4672,13 +5211,16 @@ _handleMcpServeFlag_fn = async function(processArgs, _mcpServeIndex) {
4672
5211
  mcpLogger.mcpError(
4673
5212
  `Found MCP server configuration: ${((_a = mcpServerConfig.serverInfo) == null ? void 0 : _a.name) || "unnamed"}`
4674
5213
  );
4675
- const transportOptions = __privateMethod(this, _ArgParserBase_instances, _parseMcpTransportOptions_fn).call(this, processArgs);
5214
+ mcpLogger.mcpError(`Using log path: ${resolvedLogPath}`);
4676
5215
  mcpLogger.mcpError(
4677
5216
  `Transport options: ${JSON.stringify(transportOptions)}`
4678
5217
  );
4679
5218
  try {
4680
5219
  mcpLogger.mcpError("Starting unified MCP server with all tools");
4681
- await __privateMethod(this, _ArgParserBase_instances, _startUnifiedMcpServer_fn).call(this, mcpServerConfig, transportOptions);
5220
+ await __privateMethod(this, _ArgParserBase_instances, _startUnifiedMcpServer_fn).call(this, mcpServerConfig, {
5221
+ ...transportOptions,
5222
+ logPath: resolvedLogPath
5223
+ });
4682
5224
  mcpLogger.mcpError("Successfully started unified MCP server");
4683
5225
  } catch (error) {
4684
5226
  mcpLogger.mcpError(
@@ -4747,7 +5289,8 @@ _startUnifiedMcpServer_fn = async function(mcpServerConfig, transportOptions) {
4747
5289
  await mcpParser.startMcpServerWithMultipleTransports(
4748
5290
  serverInfo,
4749
5291
  transportConfigs,
4750
- toolOptions
5292
+ toolOptions,
5293
+ transportOptions.logPath
4751
5294
  );
4752
5295
  } catch (error) {
4753
5296
  throw new Error(
@@ -4758,7 +5301,8 @@ _startUnifiedMcpServer_fn = async function(mcpServerConfig, transportOptions) {
4758
5301
  await mcpParser.startMcpServerWithMultipleTransports(
4759
5302
  serverInfo,
4760
5303
  defaultTransports,
4761
- toolOptions
5304
+ toolOptions,
5305
+ transportOptions.logPath
4762
5306
  );
4763
5307
  } else if (defaultTransport) {
4764
5308
  await mcpParser.startMcpServerWithTransport(
@@ -4770,7 +5314,8 @@ _startUnifiedMcpServer_fn = async function(mcpServerConfig, transportOptions) {
4770
5314
  path: defaultTransport.path,
4771
5315
  sessionIdGenerator: defaultTransport.sessionIdGenerator
4772
5316
  },
4773
- toolOptions
5317
+ toolOptions,
5318
+ transportOptions.logPath
4774
5319
  );
4775
5320
  } else {
4776
5321
  const transportType = transportOptions.transportType || "stdio";
@@ -4783,7 +5328,8 @@ _startUnifiedMcpServer_fn = async function(mcpServerConfig, transportOptions) {
4783
5328
  serverInfo,
4784
5329
  transportType,
4785
5330
  finalTransportOptions,
4786
- toolOptions
5331
+ toolOptions,
5332
+ transportOptions.logPath
4787
5333
  );
4788
5334
  }
4789
5335
  };
@@ -4850,6 +5396,12 @@ _parseMcpTransportOptions_fn = function(processArgs) {
4850
5396
  i++;
4851
5397
  }
4852
5398
  break;
5399
+ case "--s-mcp-log-path":
5400
+ if (nextArg && !nextArg.startsWith("-")) {
5401
+ options.logPath = nextArg;
5402
+ i++;
5403
+ }
5404
+ break;
4853
5405
  // Backward compatibility: support old flags but with deprecation warning
4854
5406
  case "--transport":
4855
5407
  case "--port":
@@ -6135,11 +6687,14 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6135
6687
  * @param toolOptions Optional MCP tool generation options
6136
6688
  * @returns Configured MCP server instance
6137
6689
  */
6138
- async createMcpServer(serverInfo, toolOptions) {
6139
- var _a;
6140
- const logger = simpleMcpLogger.createMcpLogger("MCP Server Creation", "./logs/mcp.log");
6690
+ async createMcpServer(serverInfo, toolOptions, logPath) {
6691
+ var _a, _b;
6692
+ const resolvedLogPath = resolveLogPath(
6693
+ logPath || ((_a = this._mcpServerConfig) == null ? void 0 : _a.logPath) || "./logs/mcp.log"
6694
+ );
6695
+ const logger = simpleMcpLogger.createMcpLogger("MCP Server Creation", resolvedLogPath);
6141
6696
  try {
6142
- const effectiveServerInfo = serverInfo || ((_a = this._mcpServerConfig) == null ? void 0 : _a.serverInfo);
6697
+ const effectiveServerInfo = serverInfo || ((_b = this._mcpServerConfig) == null ? void 0 : _b.serverInfo);
6143
6698
  if (!effectiveServerInfo) {
6144
6699
  throw new Error(
6145
6700
  "No MCP server configuration found. Use withMcp() to configure server info or provide serverInfo parameter."
@@ -6320,11 +6875,11 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6320
6875
  * @param toolOptions Optional MCP tool generation options
6321
6876
  * @returns Promise that resolves when all servers are started
6322
6877
  */
6323
- async startMcpServerWithMultipleTransports(serverInfo, transports, toolOptions) {
6324
- const server = await this.createMcpServer(serverInfo, toolOptions);
6878
+ async startMcpServerWithMultipleTransports(serverInfo, transports, toolOptions, logPath) {
6879
+ const server = await this.createMcpServer(serverInfo, toolOptions, logPath);
6325
6880
  const startPromises = [];
6326
6881
  for (const transportConfig of transports) {
6327
- const promise = __privateMethod(this, _ArgParser_instances, _startSingleTransport_fn).call(this, server, serverInfo, transportConfig);
6882
+ const promise = __privateMethod(this, _ArgParser_instances, _startSingleTransport_fn).call(this, server, serverInfo, transportConfig, logPath);
6328
6883
  startPromises.push(promise);
6329
6884
  }
6330
6885
  await Promise.all(startPromises);
@@ -6337,12 +6892,12 @@ Migration guide: https://github.com/alcyone-labs/arg-parser/blob/main/docs/MCP-M
6337
6892
  * @param toolOptions Optional MCP tool generation options
6338
6893
  * @returns Promise that resolves when server is connected
6339
6894
  */
6340
- async startMcpServerWithTransport(serverInfo, transportType, transportOptions = {}, toolOptions) {
6341
- const server = await this.createMcpServer(serverInfo, toolOptions);
6895
+ async startMcpServerWithTransport(serverInfo, transportType, transportOptions = {}, toolOptions, logPath) {
6896
+ const server = await this.createMcpServer(serverInfo, toolOptions, logPath);
6342
6897
  await __privateMethod(this, _ArgParser_instances, _startSingleTransport_fn).call(this, server, serverInfo, {
6343
6898
  type: transportType,
6344
6899
  ...transportOptions
6345
- });
6900
+ }, logPath);
6346
6901
  }
6347
6902
  async parse(processArgs, options) {
6348
6903
  let result = await ArgParserBase.prototype.parse.call(
@@ -6604,8 +7159,9 @@ registerToolAsSubCommand_fn = function(toolConfig) {
6604
7159
  handler: toolConfig.handler
6605
7160
  });
6606
7161
  };
6607
- _startSingleTransport_fn = async function(server, serverInfo, transportConfig) {
6608
- const logger = simpleMcpLogger.createMcpLogger("MCP Transport", "./logs/mcp.log");
7162
+ _startSingleTransport_fn = async function(server, serverInfo, transportConfig, logPath) {
7163
+ const resolvedLogPath = resolveLogPath(logPath || "./logs/mcp.log");
7164
+ const logger = simpleMcpLogger.createMcpLogger("MCP Transport", resolvedLogPath);
6609
7165
  try {
6610
7166
  logger.mcpError(
6611
7167
  `Starting ${transportConfig.type} transport for server: ${serverInfo.name}`
@@ -6781,7 +7337,9 @@ class TomlConfigPlugin extends ConfigPlugin {
6781
7337
  }
6782
7338
  return parsed;
6783
7339
  } catch (error) {
6784
- throw new Error(`Failed to parse TOML: ${error instanceof Error ? error.message : String(error)}`);
7340
+ throw new Error(
7341
+ `Failed to parse TOML: ${error instanceof Error ? error.message : String(error)}`
7342
+ );
6785
7343
  }
6786
7344
  }
6787
7345
  generate(_config, flags, parsedArgs) {
@@ -6821,7 +7379,9 @@ class TomlConfigPlugin extends ConfigPlugin {
6821
7379
  const tomlContent = this.tomlModule.stringify(configWithValues);
6822
7380
  return lines.join("\n") + "\n" + tomlContent;
6823
7381
  } catch (error) {
6824
- throw new Error(`Failed to generate TOML: ${error instanceof Error ? error.message : String(error)}`);
7382
+ throw new Error(
7383
+ `Failed to generate TOML: ${error instanceof Error ? error.message : String(error)}`
7384
+ );
6825
7385
  }
6826
7386
  }
6827
7387
  /**
@@ -6857,7 +7417,10 @@ function createTomlPlugin() {
6857
7417
  try {
6858
7418
  return new TomlConfigPlugin();
6859
7419
  } catch (error) {
6860
- console.warn("TOML plugin not available:", error instanceof Error ? error.message : String(error));
7420
+ console.warn(
7421
+ "TOML plugin not available:",
7422
+ error instanceof Error ? error.message : String(error)
7423
+ );
6861
7424
  return null;
6862
7425
  }
6863
7426
  }
@@ -6873,7 +7436,10 @@ async function createTomlPluginAsync() {
6873
7436
  const tomlModule = await Promise.resolve().then(() => index$1);
6874
7437
  return new TomlConfigPlugin(tomlModule);
6875
7438
  } catch (error) {
6876
- console.warn("TOML plugin not available:", error instanceof Error ? error.message : String(error));
7439
+ console.warn(
7440
+ "TOML plugin not available:",
7441
+ error instanceof Error ? error.message : String(error)
7442
+ );
6877
7443
  return null;
6878
7444
  }
6879
7445
  }
@@ -6919,7 +7485,9 @@ class YamlConfigPlugin extends ConfigPlugin {
6919
7485
  }
6920
7486
  return parsed;
6921
7487
  } catch (error) {
6922
- throw new Error(`Failed to parse YAML: ${error instanceof Error ? error.message : String(error)}`);
7488
+ throw new Error(
7489
+ `Failed to parse YAML: ${error instanceof Error ? error.message : String(error)}`
7490
+ );
6923
7491
  }
6924
7492
  }
6925
7493
  generate(_config, flags, parsedArgs) {
@@ -6953,7 +7521,9 @@ class YamlConfigPlugin extends ConfigPlugin {
6953
7521
  });
6954
7522
  return lines.join("\n") + "\n" + yamlContent;
6955
7523
  } catch (error) {
6956
- throw new Error(`Failed to generate YAML: ${error instanceof Error ? error.message : String(error)}`);
7524
+ throw new Error(
7525
+ `Failed to generate YAML: ${error instanceof Error ? error.message : String(error)}`
7526
+ );
6957
7527
  }
6958
7528
  }
6959
7529
  /**
@@ -6983,7 +7553,10 @@ function createYamlPlugin() {
6983
7553
  try {
6984
7554
  return new YamlConfigPlugin();
6985
7555
  } catch (error) {
6986
- console.warn("YAML plugin not available:", error instanceof Error ? error.message : String(error));
7556
+ console.warn(
7557
+ "YAML plugin not available:",
7558
+ error instanceof Error ? error.message : String(error)
7559
+ );
6987
7560
  return null;
6988
7561
  }
6989
7562
  }
@@ -6999,7 +7572,10 @@ async function createYamlPluginAsync() {
6999
7572
  const yamlModule = await import("js-yaml");
7000
7573
  return new YamlConfigPlugin(yamlModule);
7001
7574
  } catch (error) {
7002
- console.warn("YAML plugin not available:", error instanceof Error ? error.message : String(error));
7575
+ console.warn(
7576
+ "YAML plugin not available:",
7577
+ error instanceof Error ? error.message : String(error)
7578
+ );
7003
7579
  return null;
7004
7580
  }
7005
7581
  }
@@ -7028,7 +7604,9 @@ class ArgParserFuzzyTester {
7028
7604
  const results = [];
7029
7605
  if (this.options.verbose) {
7030
7606
  console.log(`Discovered ${commandPaths.length} command paths:`);
7031
- commandPaths.forEach((path2) => console.log(` ${path2.join(" ") || "(root)"}`));
7607
+ commandPaths.forEach(
7608
+ (path2) => console.log(` ${path2.join(" ") || "(root)"}`)
7609
+ );
7032
7610
  }
7033
7611
  for (const commandPath of commandPaths) {
7034
7612
  const pathResults = await this.testCommandPath(commandPath);
@@ -7054,7 +7632,12 @@ class ArgParserFuzzyTester {
7054
7632
  for (const [subCommandName, subCommand] of subCommands) {
7055
7633
  const newPath = [...currentPath, subCommandName];
7056
7634
  allPaths.push(newPath);
7057
- this.discoverSubCommandPaths(subCommand.parser, newPath, allPaths, depth + 1);
7635
+ this.discoverSubCommandPaths(
7636
+ subCommand.parser,
7637
+ newPath,
7638
+ allPaths,
7639
+ depth + 1
7640
+ );
7058
7641
  }
7059
7642
  }
7060
7643
  /**
@@ -24960,6 +25543,7 @@ exports.OutputSchemaPatterns = OutputSchemaPatterns;
24960
25543
  exports.SimpleChalk = simpleChalk;
24961
25544
  exports.TomlConfigPlugin = TomlConfigPlugin;
24962
25545
  exports.YamlConfigPlugin = YamlConfigPlugin;
25546
+ exports.absolutePath = absolutePath;
24963
25547
  exports.convertFlagToJsonSchemaProperty = convertFlagToJsonSchemaProperty;
24964
25548
  exports.convertFlagsToJsonSchema = convertFlagsToJsonSchema;
24965
25549
  exports.convertFlagsToZodSchema = convertFlagsToZodSchema;
@@ -24971,12 +25555,18 @@ exports.createTomlPlugin = createTomlPlugin;
24971
25555
  exports.createTomlPluginAsync = createTomlPluginAsync;
24972
25556
  exports.createYamlPlugin = createYamlPlugin;
24973
25557
  exports.createYamlPluginAsync = createYamlPluginAsync;
25558
+ exports.cwdRelative = cwdRelative;
25559
+ exports.detectEntryPoint = detectEntryPoint;
24974
25560
  exports.enableConfigPlugins = enableConfigPlugins;
24975
25561
  exports.enableOptionalConfigPlugins = enableOptionalConfigPlugins;
24976
25562
  exports.enableOptionalConfigPluginsAsync = enableOptionalConfigPluginsAsync;
25563
+ exports.entryRelative = entryRelative;
24977
25564
  exports.extractSimplifiedResponse = extractSimplifiedResponse;
24978
25565
  exports.generateMcpToolsFromArgParser = generateMcpToolsFromArgParser;
25566
+ exports.getEntryPointFromImportMeta = getEntryPointFromImportMeta;
24979
25567
  exports.getJsonSchemaTypeFromFlag = getJsonSchemaTypeFromFlag;
24980
25568
  exports.globalConfigPluginRegistry = globalConfigPluginRegistry;
25569
+ exports.legacyCwdPath = legacyCwdPath;
25570
+ exports.resolveLogPath = resolveLogPath;
24981
25571
  exports.zodFlagSchema = zodFlagSchema;
24982
25572
  //# sourceMappingURL=index.cjs.map