agentaudit 3.9.0 → 3.9.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 (2) hide show
  1. package/cli.mjs +16 -13
  2. package/package.json +1 -1
package/cli.mjs CHANGED
@@ -155,7 +155,7 @@ function multiSelect(items, { title = 'Select items', hint = 'Space=toggle ↑
155
155
  process.stdin.pause();
156
156
  process.stdin.removeListener('data', onData);
157
157
  console.log();
158
- process.exit(0);
158
+ process.exitCode = 0; return;
159
159
  }
160
160
 
161
161
  // Enter
@@ -1502,7 +1502,7 @@ async function main() {
1502
1502
 
1503
1503
  if (args[0] === '-v' || args[0] === '--version') {
1504
1504
  console.log(`agentaudit ${getVersion()}`);
1505
- process.exit(0);
1505
+ process.exitCode = 0; return;
1506
1506
  }
1507
1507
 
1508
1508
  if (args[0] === '--help' || args[0] === '-h') {
@@ -1551,7 +1551,7 @@ async function main() {
1551
1551
  console.log(` ${c.dim}Add to your MCP config:${c.reset}`);
1552
1552
  console.log(` ${c.dim}{ "agentaudit": { "command": "npx", "args": ["-y", "agentaudit"] } }${c.reset}`);
1553
1553
  console.log();
1554
- process.exit(0);
1554
+ process.exitCode = 0; return;
1555
1555
  }
1556
1556
 
1557
1557
  // Default no-arg → discover
@@ -1576,7 +1576,8 @@ async function main() {
1576
1576
  const names = targets.filter(t => !t.startsWith('--'));
1577
1577
  if (names.length === 0) {
1578
1578
  console.log(` ${c.red}Error: package name required${c.reset}`);
1579
- process.exit(2);
1579
+ process.exitCode = 2;
1580
+ return;
1580
1581
  }
1581
1582
  const results = [];
1582
1583
  for (const t of names) {
@@ -1586,7 +1587,7 @@ async function main() {
1586
1587
  if (jsonMode) {
1587
1588
  console.log(JSON.stringify(results.length === 1 ? (results[0] || { error: 'not_found' }) : results, null, 2));
1588
1589
  }
1589
- process.exit(0);
1590
+ process.exitCode = 0; return;
1590
1591
  return;
1591
1592
  }
1592
1593
 
@@ -1597,7 +1598,8 @@ async function main() {
1597
1598
  console.log(` ${c.red}Error: at least one repository URL required${c.reset}`);
1598
1599
  console.log(` ${c.dim}Tip: use ${c.cyan}agentaudit discover${c.dim} to find & check locally installed MCP servers${c.reset}`);
1599
1600
  console.log(` ${c.dim}Tip: use ${c.cyan}agentaudit audit <url>${c.dim} for a deep LLM-powered audit${c.reset}`);
1600
- process.exit(2);
1601
+ process.exitCode = 2;
1602
+ return;
1601
1603
  }
1602
1604
 
1603
1605
  // --deep redirects to audit flow
@@ -1607,7 +1609,7 @@ async function main() {
1607
1609
  const report = await auditRepo(url);
1608
1610
  if (report?.findings?.length > 0) hasFindings = true;
1609
1611
  }
1610
- process.exit(hasFindings ? 1 : 0);
1612
+ process.exitCode = hasFindings ? 1 : 0;
1611
1613
  return;
1612
1614
  }
1613
1615
 
@@ -1638,9 +1640,9 @@ async function main() {
1638
1640
  printSummary(results);
1639
1641
  }
1640
1642
 
1641
- if (hadErrors && results.length === 0) process.exit(2);
1643
+ if (hadErrors && results.length === 0) { process.exitCode = 2; return; }
1642
1644
  const totalFindings = results.reduce((sum, r) => sum + r.findings.length, 0);
1643
- process.exit(totalFindings > 0 ? 1 : 0);
1645
+ process.exitCode = totalFindings > 0 ? 1 : 0;
1644
1646
  return;
1645
1647
  }
1646
1648
 
@@ -1648,7 +1650,8 @@ async function main() {
1648
1650
  const urls = targets.filter(t => !t.startsWith('--'));
1649
1651
  if (urls.length === 0) {
1650
1652
  console.log(` ${c.red}Error: at least one repository URL required${c.reset}`);
1651
- process.exit(2);
1653
+ process.exitCode = 2;
1654
+ return;
1652
1655
  }
1653
1656
 
1654
1657
  let hasFindings = false;
@@ -1656,16 +1659,16 @@ async function main() {
1656
1659
  const report = await auditRepo(url);
1657
1660
  if (report?.findings?.length > 0) hasFindings = true;
1658
1661
  }
1659
- process.exit(hasFindings ? 1 : 0);
1662
+ process.exitCode = hasFindings ? 1 : 0;
1660
1663
  return;
1661
1664
  }
1662
1665
 
1663
1666
  console.log(` ${c.red}Unknown command: ${command}${c.reset}`);
1664
1667
  console.log(` ${c.dim}Run agentaudit --help for usage${c.reset}`);
1665
- process.exit(2);
1668
+ process.exitCode = 2;
1666
1669
  }
1667
1670
 
1668
1671
  main().catch(err => {
1669
1672
  console.error(`${c.red}Error: ${err.message}${c.reset}`);
1670
- process.exit(2);
1673
+ process.exitCode = 2;
1671
1674
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentaudit",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "description": "Security scanner for AI packages — MCP server + CLI",
5
5
  "type": "module",
6
6
  "bin": {