agentaudit 3.9.27 → 3.9.29

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 (3) hide show
  1. package/cli.mjs +2264 -2229
  2. package/index.mjs +49 -1
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -330,6 +330,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
330
330
  required: ['package_name'],
331
331
  },
332
332
  },
333
+ {
334
+ name: 'agent_stats',
335
+ description: 'Get your AgentAudit account stats: total audits, findings, points, leaderboard rank. Use to check your progress or show your security contribution stats.',
336
+ inputSchema: { type: 'object', properties: {} },
337
+ },
333
338
  ],
334
339
  }));
335
340
 
@@ -594,8 +599,51 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
594
599
  }
595
600
  }
596
601
 
602
+ case 'agent_stats': {
603
+ const creds = loadCredentials();
604
+ if (!creds?.api_key || !creds?.agent_name) {
605
+ return { content: [{ type: 'text', text: '⚠️ Not logged in. Run `agentaudit setup` first to register.' }] };
606
+ }
607
+ try {
608
+ // Fetch agent profile
609
+ const profileRes = await fetch(`${REGISTRY_URL}/api/agents/${encodeURIComponent(creds.agent_name)}`, { signal: AbortSignal.timeout(8000) });
610
+ // Fetch leaderboard for rank
611
+ const lbRes = await fetch(`${REGISTRY_URL}/api/leaderboard`, { signal: AbortSignal.timeout(8000) });
612
+
613
+ let stats = '';
614
+ stats += `🛡️ AgentAudit — ${creds.agent_name}\n\n`;
615
+
616
+ if (profileRes.ok) {
617
+ const profile = await profileRes.json();
618
+ stats += `📊 Your Stats:\n`;
619
+ stats += ` Reports: ${profile.total_reports || 0}\n`;
620
+ stats += ` Findings: ${profile.total_findings_submitted || 0}\n`;
621
+ stats += ` Points: ${profile.total_points || 0}\n`;
622
+ if (profile.critical_found > 0) stats += ` Critical: ${profile.critical_found} 🔴\n`;
623
+ if (profile.high_found > 0) stats += ` High: ${profile.high_found} 🟠\n`;
624
+ stats += ` Packages: ${profile.skills_audited?.length || 0} unique\n`;
625
+ }
626
+
627
+ if (lbRes.ok) {
628
+ const agents = await lbRes.json();
629
+ const idx = Array.isArray(agents) ? agents.findIndex(a => (a.agent_name || '').toLowerCase() === creds.agent_name.toLowerCase()) : -1;
630
+ if (idx >= 0) {
631
+ const rank = idx + 1;
632
+ const medal = rank === 1 ? '🥇' : rank === 2 ? '🥈' : rank === 3 ? '🥉' : `#${rank}`;
633
+ stats += `\n🏆 Leaderboard: ${medal} of ${agents.length}\n`;
634
+ if (agents[idx].is_official) stats += ` ✔ Official Auditor\n`;
635
+ }
636
+ }
637
+
638
+ stats += `\nProfile: ${REGISTRY_URL}/agents/${encodeURIComponent(creds.agent_name)}`;
639
+ return { content: [{ type: 'text', text: stats }] };
640
+ } catch (err) {
641
+ return { content: [{ type: 'text', text: `Failed to fetch stats: ${err.message}` }] };
642
+ }
643
+ }
644
+
597
645
  default:
598
- return { content: [{ type: 'text', text: `Unknown tool: ${name}. Available: discover_servers, audit_package, submit_report, check_package` }] };
646
+ return { content: [{ type: 'text', text: `Unknown tool: ${name}. Available: discover_servers, audit_package, submit_report, check_package, agent_stats` }] };
599
647
  }
600
648
  });
601
649
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentaudit",
3
- "version": "3.9.27",
3
+ "version": "3.9.29",
4
4
  "description": "Security scanner for AI packages — MCP server + CLI",
5
5
  "type": "module",
6
6
  "bin": {