@0dai-dev/cli 3.1.1 → 3.1.3

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 +43 -11
  2. package/package.json +1 -1
package/bin/0dai.js CHANGED
@@ -7,7 +7,7 @@ const fs = require("fs");
7
7
  const path = require("path");
8
8
  const os = require("os");
9
9
 
10
- const VERSION = "3.0.0";
10
+ const VERSION = require("../package.json").version;
11
11
  const API_URL = process.env.ODAI_API_URL || "https://api.0dai.dev";
12
12
  const T = process.stdout.isTTY ? "\x1b[38;2;45;212;168m" : ""; // teal
13
13
  const R = process.stdout.isTTY ? "\x1b[0m" : ""; // reset
@@ -680,21 +680,53 @@ function cmdDoctor(target) {
680
680
  };
681
681
 
682
682
  // --- credentials checklist ---
683
+ // Detect subscription-based auth (not just env API keys)
684
+ const { execFileSync: _execFile } = require("child_process");
685
+ function cliAuthed(cli) {
686
+ try {
687
+ if (cli === "claude") {
688
+ const out = _execFile("claude", ["auth", "status"], { timeout: 5000 }).toString();
689
+ try { return JSON.parse(out).loggedIn === true; } catch {}
690
+ return out.includes("loggedIn");
691
+ }
692
+ _execFile("which", [cli], { timeout: 2000 });
693
+ return true;
694
+ } catch { return false; }
695
+ }
696
+
697
+ const claudeAuth = cliAuthed("claude");
698
+ const codexAuth = cliAuthed("codex");
699
+
683
700
  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" },
701
+ {
702
+ name: "Claude Code",
703
+ present: claudeAuth || !!process.env.ANTHROPIC_API_KEY,
704
+ sev: (claudeAuth || process.env.ANTHROPIC_API_KEY) ? "ok" : "warn",
705
+ hint: claudeAuth ? "authenticated via subscription" : "run: claude auth login (or set ANTHROPIC_API_KEY)",
706
+ },
707
+ {
708
+ name: "Codex CLI",
709
+ present: codexAuth || !!process.env.OPENAI_API_KEY,
710
+ sev: (codexAuth || process.env.OPENAI_API_KEY) ? "ok" : "warn",
711
+ hint: codexAuth ? "installed (uses ChatGPT subscription)" : "run: npm i -g @openai/codex (or set OPENAI_API_KEY)",
712
+ },
713
+ {
714
+ name: "GITHUB_TOKEN",
715
+ present: !!process.env.GITHUB_TOKEN,
716
+ sev: process.env.GITHUB_TOKEN ? "ok" : "info",
717
+ hint: "Optional — for gh CLI, PR creation",
718
+ },
687
719
  ];
688
720
 
689
721
  // Stack-specific creds
690
722
  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" });
723
+ credChecks.push({ name: "VERCEL_TOKEN", present: !!process.env.VERCEL_TOKEN, sev: process.env.VERCEL_TOKEN ? "ok" : "info", hint: "Optional for Vercel deployments" });
692
724
  }
693
725
  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" });
726
+ 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
727
  }
696
728
  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" });
729
+ 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
730
  }
699
731
 
700
732
  // --- run checks ---
@@ -725,10 +757,10 @@ function cmdDoctor(target) {
725
757
 
726
758
  console.log("\n credentials:");
727
759
  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}` : ""}`);
760
+ if (!c.present && c.sev === "warn") warnings++;
761
+ const mark = c.present ? `${G}ok${R2}` : c.sev === "warn" ? `${W}not set${R2}` : `${D}not set${R2}`;
762
+ const hint = c.present && c.hint.includes("subscription") ? ` ${D}(${c.hint})${R2}` : (!c.present ? `\n ${D} ${c.hint}${R2}` : "");
763
+ console.log(` ${mark.padEnd(22)} ${c.name}${hint}`);
732
764
  }
733
765
 
734
766
  // --- swarm check ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0dai-dev/cli",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
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"