@agentforge/cli 0.15.10 → 0.15.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1406,12 +1406,21 @@ tool.command("list").description("List all tools").option("-c, --category <categ
1406
1406
  tool.command("test <name>").description("Test a specific tool").option("-w, --watch", "Watch mode").action(toolTestCommand);
1407
1407
  tool.command("publish <name>").description("Publish a tool to npm").option("--tag <tag>", "npm tag", "latest").option("--dry-run", "Dry run without actual publishing").action(toolPublishCommand);
1408
1408
  program.exitOverride();
1409
+ function isCommanderExit(error) {
1410
+ return typeof error === "object" && error !== null;
1411
+ }
1412
+ function isExpectedCommanderExit(error) {
1413
+ if (!isCommanderExit(error)) {
1414
+ return false;
1415
+ }
1416
+ return error.exitCode === 0 || error.code === "commander.help" || error.code === "commander.helpDisplayed" || error.code === "commander.version";
1417
+ }
1409
1418
  async function run() {
1410
1419
  try {
1411
1420
  await program.parseAsync(process.argv);
1412
1421
  } catch (error) {
1413
- if (error.code !== "commander.help" && error.code !== "commander.version") {
1414
- console.error(chalk4__default.default.red("Error:"), error.message);
1422
+ if (!isExpectedCommanderExit(error)) {
1423
+ console.error(chalk4__default.default.red("Error:"), error instanceof Error ? error.message : String(error));
1415
1424
  process.exit(1);
1416
1425
  }
1417
1426
  }