@0dai-dev/cli 3.1.2 → 3.1.4

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/bin/0dai.js +58 -11
  2. package/package.json +1 -1
package/bin/0dai.js CHANGED
@@ -424,10 +424,25 @@ async function cmdInit(target, args = []) {
424
424
  log(`initialized (${result.file_count || "?"} files)`);
425
425
  console.log(" skills: /build /review /status /feedback /bugfix /delegate");
426
426
 
427
+ // Detect agent auth status for smart onboarding hints
428
+ const { execFileSync: _ef } = require("child_process");
429
+ const agents = [];
430
+ try { _ef("claude", ["--version"], { timeout: 3000 }); agents.push("claude"); } catch {}
431
+ try { _ef("codex", ["--version"], { timeout: 3000 }); agents.push("codex"); } catch {}
432
+ try { _ef("gemini", ["--version"], { timeout: 3000 }); agents.push("gemini"); } catch {}
433
+
427
434
  // Next steps — guide user to first value
428
435
  console.log(`\n ${T}Next steps:${R}`);
429
436
  console.log(` ${D}1.${R} Check health: ${D}0dai doctor${R}`);
430
- console.log(` ${D}2.${R} Try delegation: ${D}0dai run "write tests for auth"${R}`);
437
+ if (agents.length > 0) {
438
+ const a = agents[0];
439
+ console.log(` ${D}2.${R} Try delegation: ${D}0dai run "write tests for auth"${R}`);
440
+ console.log(` ${D}(${agents.join(", ")} detected — delegation will use ${a} by default)${R}`);
441
+ } else {
442
+ console.log(` ${D}2.${R} Install an agent CLI to enable delegation:`);
443
+ console.log(` ${D}claude:${R} npm i -g @anthropic-ai/claude-code ${D}(or Pro subscription)${R}`);
444
+ console.log(` ${D}codex:${R} npm i -g @openai/codex ${D}(or ChatGPT Pro)${R}`);
445
+ }
431
446
  console.log(` ${D}3.${R} Open dashboard: ${D}https://0dai.dev/dashboard${R}`);
432
447
 
433
448
  // Send anonymous usage ping
@@ -680,21 +695,53 @@ function cmdDoctor(target) {
680
695
  };
681
696
 
682
697
  // --- credentials checklist ---
698
+ // Detect subscription-based auth (not just env API keys)
699
+ const { execFileSync: _execFile } = require("child_process");
700
+ function cliAuthed(cli) {
701
+ try {
702
+ if (cli === "claude") {
703
+ const out = _execFile("claude", ["auth", "status"], { timeout: 5000 }).toString();
704
+ try { return JSON.parse(out).loggedIn === true; } catch {}
705
+ return out.includes("loggedIn");
706
+ }
707
+ _execFile("which", [cli], { timeout: 2000 });
708
+ return true;
709
+ } catch { return false; }
710
+ }
711
+
712
+ const claudeAuth = cliAuthed("claude");
713
+ const codexAuth = cliAuthed("codex");
714
+
683
715
  const credChecks = [
684
- { name: "ANTHROPIC_API_KEY", env: "ANTHROPIC_API_KEY", needed: true, sev: "error", hint: "Required for Claude Code — get at console.anthropic.com" },
685
- { name: "OPENAI_API_KEY", env: "OPENAI_API_KEY", needed: false, sev: "warn", hint: "Required for Codex CLI — get at platform.openai.com" },
686
- { name: "GITHUB_TOKEN", env: "GITHUB_TOKEN", needed: false, sev: "warn", hint: "Needed for gh CLI, PR creation, swarm delegation" },
716
+ {
717
+ name: "Claude Code",
718
+ present: claudeAuth || !!process.env.ANTHROPIC_API_KEY,
719
+ sev: (claudeAuth || process.env.ANTHROPIC_API_KEY) ? "ok" : "warn",
720
+ hint: claudeAuth ? "authenticated via subscription" : "run: claude auth login (or set ANTHROPIC_API_KEY)",
721
+ },
722
+ {
723
+ name: "Codex CLI",
724
+ present: codexAuth || !!process.env.OPENAI_API_KEY,
725
+ sev: (codexAuth || process.env.OPENAI_API_KEY) ? "ok" : "warn",
726
+ hint: codexAuth ? "installed (uses ChatGPT subscription)" : "run: npm i -g @openai/codex (or set OPENAI_API_KEY)",
727
+ },
728
+ {
729
+ name: "GITHUB_TOKEN",
730
+ present: !!process.env.GITHUB_TOKEN,
731
+ sev: process.env.GITHUB_TOKEN ? "ok" : "info",
732
+ hint: "Optional — for gh CLI, PR creation",
733
+ },
687
734
  ];
688
735
 
689
736
  // Stack-specific creds
690
737
  if (stack.includes("vercel") || stack.includes("next")) {
691
- credChecks.push({ name: "VERCEL_TOKEN", env: "VERCEL_TOKEN", needed: false, sev: "warn", hint: "Required for Vercel deployments — get at vercel.com/account/tokens" });
738
+ credChecks.push({ name: "VERCEL_TOKEN", present: !!process.env.VERCEL_TOKEN, sev: process.env.VERCEL_TOKEN ? "ok" : "info", hint: "Optional for Vercel deployments" });
692
739
  }
693
740
  if (stack.includes("aws") || stack.includes("lambda") || stack.includes("cdk")) {
694
- credChecks.push({ name: "AWS_ACCESS_KEY_ID", env: "AWS_ACCESS_KEY_ID", needed: false, sev: "warn", hint: "Required for AWS deployments" });
741
+ credChecks.push({ name: "AWS_ACCESS_KEY_ID", present: !!process.env.AWS_ACCESS_KEY_ID, sev: process.env.AWS_ACCESS_KEY_ID ? "ok" : "info", hint: "Optional for AWS deployments" });
695
742
  }
696
743
  if (stack.includes("gcp") || stack.includes("firebase") || stack.includes("flutter")) {
697
- credChecks.push({ name: "GOOGLE_APPLICATION_CREDENTIALS", env: "GOOGLE_APPLICATION_CREDENTIALS", needed: false, sev: "warn", hint: "Required for GCP/Firebase deployments" });
744
+ credChecks.push({ name: "GCP_CREDENTIALS", present: !!process.env.GOOGLE_APPLICATION_CREDENTIALS, sev: process.env.GOOGLE_APPLICATION_CREDENTIALS ? "ok" : "info", hint: "Optional for GCP/Firebase" });
698
745
  }
699
746
 
700
747
  // --- run checks ---
@@ -725,10 +772,10 @@ function cmdDoctor(target) {
725
772
 
726
773
  console.log("\n credentials:");
727
774
  for (const c of credChecks) {
728
- const present = !!process.env[c.env];
729
- if (!present) c.sev === "error" ? errors++ : warnings++;
730
- const mark = present ? `${G}set${R2}` : c.sev === "error" ? `${E}NOT SET${R2}` : `${W}not set${R2}`;
731
- console.log(` ${mark.padEnd(22)} ${c.name}${!present ? `\n ${D}→ ${c.hint}${R2}` : ""}`);
775
+ if (!c.present && c.sev === "warn") warnings++;
776
+ const mark = c.present ? `${G}ok${R2}` : c.sev === "warn" ? `${W}not set${R2}` : `${D}not set${R2}`;
777
+ const hint = c.present && c.hint.includes("subscription") ? ` ${D}(${c.hint})${R2}` : (!c.present ? `\n ${D} ${c.hint}${R2}` : "");
778
+ console.log(` ${mark.padEnd(22)} ${c.name}${hint}`);
732
779
  }
733
780
 
734
781
  // --- swarm check ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0dai-dev/cli",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "One config layer for 5 AI agent CLIs — Claude Code, Codex, OpenCode, Gemini, Aider",
5
5
  "bin": {
6
6
  "0dai": "./bin/0dai.js"