agentaudit 3.9.30 โ 3.9.32
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/cli.mjs +13 -8
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -403,18 +403,21 @@ function getVersion() {
|
|
|
403
403
|
} catch { return '0.0.0'; }
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
function banner() {
|
|
406
|
+
async function banner() {
|
|
407
407
|
if (quietMode || jsonMode) return;
|
|
408
408
|
const creds = loadCredentials();
|
|
409
409
|
const agentInfo = creds?.agent_name ? ` ${c.dim}ยท${c.reset} ${c.green}${creds.agent_name}${c.reset}` : '';
|
|
410
410
|
console.log();
|
|
411
411
|
console.log(` ๐ก ${c.bold}${c.cyan}AgentAudit${c.reset} ${c.dim}v${getVersion()}${c.reset}${agentInfo}`);
|
|
412
|
-
// Show cached stats inline
|
|
413
412
|
if (creds?.agent_name) {
|
|
414
|
-
|
|
415
|
-
if
|
|
413
|
+
let cached = loadStatsCache();
|
|
414
|
+
// Auto-fetch if no cache or cache older than 1h
|
|
415
|
+
if (!cached || !cached._ts || (Date.now() - cached._ts > 3600000)) {
|
|
416
|
+
cached = await refreshStatsCache(creds.agent_name).catch(() => null) || cached;
|
|
417
|
+
}
|
|
418
|
+
if (cached && cached.rank) {
|
|
416
419
|
const medal = cached.rank === 1 ? '๐ฅ' : cached.rank === 2 ? '๐ฅ' : cached.rank === 3 ? '๐ฅ' : `#${cached.rank}`;
|
|
417
|
-
console.log(` ${c.dim}${medal}
|
|
420
|
+
console.log(` ${c.dim}${medal} of ${cached.total} ยท ${c.reset}${c.cyan}${cached.pts}${c.reset}${c.dim} pts ยท ${cached.reports} audits${c.reset}`);
|
|
418
421
|
}
|
|
419
422
|
} else {
|
|
420
423
|
console.log(` ${c.dim}Security scanner for AI tools${c.reset}`);
|
|
@@ -1748,12 +1751,14 @@ async function auditRepo(url) {
|
|
|
1748
1751
|
// โโ Check command โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
1749
1752
|
|
|
1750
1753
|
async function checkPackage(name, { autoAudit = false } = {}) {
|
|
1754
|
+
// Derive slug from URL for registry lookup (URLs won't match as-is)
|
|
1755
|
+
const slug = (name.includes('github.com') || name.includes('://')) ? slugFromUrl(name) : name.toLowerCase();
|
|
1751
1756
|
if (!jsonMode) {
|
|
1752
1757
|
console.log(`${icons.info} Looking up ${c.bold}${name}${c.reset} in registry...`);
|
|
1753
1758
|
console.log();
|
|
1754
1759
|
}
|
|
1755
1760
|
|
|
1756
|
-
const data = await checkRegistry(
|
|
1761
|
+
const data = await checkRegistry(slug);
|
|
1757
1762
|
if (!data) {
|
|
1758
1763
|
if (!jsonMode) {
|
|
1759
1764
|
// Auto-audit: only when called from 'check' command AND input looks like a URL
|
|
@@ -1876,7 +1881,7 @@ async function main() {
|
|
|
1876
1881
|
}
|
|
1877
1882
|
|
|
1878
1883
|
if (args[0] === '--help' || args[0] === '-h') {
|
|
1879
|
-
banner();
|
|
1884
|
+
await banner();
|
|
1880
1885
|
console.log(` ${c.bold}USAGE${c.reset}`);
|
|
1881
1886
|
console.log(` ${c.cyan}agentaudit${c.reset} <command> [options]`);
|
|
1882
1887
|
console.log();
|
|
@@ -1924,7 +1929,7 @@ async function main() {
|
|
|
1924
1929
|
const command = args.length === 0 ? 'discover' : args[0];
|
|
1925
1930
|
const targets = args.slice(1);
|
|
1926
1931
|
|
|
1927
|
-
banner();
|
|
1932
|
+
await banner();
|
|
1928
1933
|
|
|
1929
1934
|
if (command === 'setup') {
|
|
1930
1935
|
await setupCommand();
|