@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.js CHANGED
@@ -1395,12 +1395,21 @@ tool.command("list").description("List all tools").option("-c, --category <categ
1395
1395
  tool.command("test <name>").description("Test a specific tool").option("-w, --watch", "Watch mode").action(toolTestCommand);
1396
1396
  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);
1397
1397
  program.exitOverride();
1398
+ function isCommanderExit(error) {
1399
+ return typeof error === "object" && error !== null;
1400
+ }
1401
+ function isExpectedCommanderExit(error) {
1402
+ if (!isCommanderExit(error)) {
1403
+ return false;
1404
+ }
1405
+ return error.exitCode === 0 || error.code === "commander.help" || error.code === "commander.helpDisplayed" || error.code === "commander.version";
1406
+ }
1398
1407
  async function run() {
1399
1408
  try {
1400
1409
  await program.parseAsync(process.argv);
1401
1410
  } catch (error) {
1402
- if (error.code !== "commander.help" && error.code !== "commander.version") {
1403
- console.error(chalk4.red("Error:"), error.message);
1411
+ if (!isExpectedCommanderExit(error)) {
1412
+ console.error(chalk4.red("Error:"), error instanceof Error ? error.message : String(error));
1404
1413
  process.exit(1);
1405
1414
  }
1406
1415
  }