agentaudit 3.12.7 → 3.12.8

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 +28 -15
  2. package/package.json +1 -1
package/cli.mjs CHANGED
@@ -516,12 +516,12 @@ async function validateApiKey(apiKey) {
516
516
 
517
517
  async function setupCommand() {
518
518
  console.log(` ${c.bold}AgentAudit Setup${c.reset}`);
519
- console.log(` ${c.dim}Link your API key to upload audit reports to agentaudit.dev${c.reset}`);
519
+ console.log(` ${c.dim}Sign in to upload audit reports to agentaudit.dev${c.reset}`);
520
520
  console.log();
521
521
 
522
522
  const existing = loadCredentials();
523
523
  if (existing) {
524
- console.log(` ${icons.safe} Already configured as ${c.bold}${existing.agent_name}${c.reset}`);
524
+ console.log(` ${icons.safe} Already logged in as ${c.bold}${existing.agent_name}${c.reset}`);
525
525
  console.log(` ${c.dim}Key: ${existing.api_key.slice(0, 12)}...${c.reset}`);
526
526
  console.log();
527
527
  const answer = await askQuestion(` Reconfigure? ${c.dim}(y/N)${c.reset} `);
@@ -532,6 +532,25 @@ async function setupCommand() {
532
532
  console.log();
533
533
  }
534
534
 
535
+ // Offer choice: GitHub OAuth (recommended) or manual API key
536
+ console.log(` ${c.bold}How do you want to sign in?${c.reset}`);
537
+ console.log();
538
+ console.log(` ${c.cyan}1${c.reset} Sign in with GitHub ${c.dim}(recommended — opens browser)${c.reset}`);
539
+ console.log(` ${c.cyan}2${c.reset} Paste an API key manually ${c.dim}(from ${REGISTRY_URL}/profile)${c.reset}`);
540
+ console.log();
541
+ const choice = await askQuestion(` Choice ${c.dim}(1/2, default: 1):${c.reset} `);
542
+ console.log();
543
+
544
+ if (choice.trim() === '2') {
545
+ // ── Manual API key flow ──
546
+ await setupManualKey();
547
+ } else {
548
+ // ── GitHub OAuth Device Flow (default) ──
549
+ await loginCommand();
550
+ }
551
+ }
552
+
553
+ async function setupManualKey() {
535
554
  console.log(` ${c.bold}Step 1:${c.reset} Create an API key at ${c.cyan}${REGISTRY_URL}/profile${c.reset}`);
536
555
  console.log(` ${c.dim}Sign in with GitHub, then click "Create API Key".${c.reset}`);
537
556
  console.log();
@@ -556,6 +575,10 @@ async function setupCommand() {
556
575
  return;
557
576
  }
558
577
 
578
+ setupReadyMessage();
579
+ }
580
+
581
+ function setupReadyMessage() {
559
582
  console.log();
560
583
 
561
584
  // ── LLM configuration hint ──
@@ -658,14 +681,9 @@ async function loginCommand() {
658
681
  if (res.ok && data.api_key) {
659
682
  // Success!
660
683
  saveCredentials({ api_key: data.api_key, agent_name: data.agent_name });
661
- console.log(` ${c.green}${icons.safe} Logged in as ${c.bold}${data.agent_name}${c.reset}`);
684
+ console.log(`\r ${c.green}${icons.safe} Logged in as ${c.bold}${data.agent_name}${c.reset} `);
662
685
  console.log(` ${c.dim}Key saved to: ${USER_CRED_FILE}${c.reset}`);
663
- console.log();
664
- console.log(` ${c.bold}Ready!${c.reset} You can now:`);
665
- console.log(` ${c.dim}•${c.reset} Audit packages: ${c.cyan}agentaudit audit <repo-url>${c.reset}`);
666
- console.log(` ${c.dim}•${c.reset} Quick scan: ${c.cyan}agentaudit scan <repo-url>${c.reset}`);
667
- console.log(` ${c.dim}•${c.reset} Check registry: ${c.cyan}agentaudit check <name>${c.reset}`);
668
- console.log();
686
+ setupReadyMessage();
669
687
  return;
670
688
  }
671
689
 
@@ -4734,16 +4752,11 @@ async function main() {
4734
4752
 
4735
4753
  banner();
4736
4754
 
4737
- if (command === 'setup') {
4755
+ if (command === 'setup' || command === 'login') {
4738
4756
  await setupCommand();
4739
4757
  return;
4740
4758
  }
4741
4759
 
4742
- if (command === 'login') {
4743
- await loginCommand();
4744
- return;
4745
- }
4746
-
4747
4760
  if (command === 'status' || command === 'whoami') {
4748
4761
  // ── Status / diagnostic overview ──
4749
4762
  const config = loadLlmConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentaudit",
3
- "version": "3.12.7",
3
+ "version": "3.12.8",
4
4
  "description": "Security scanner for AI packages — MCP server + CLI",
5
5
  "type": "module",
6
6
  "bin": {