@0dai-dev/cli 3.1.2 → 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.
- package/bin/0dai.js +42 -10
- package/package.json +1 -1
package/bin/0dai.js
CHANGED
|
@@ -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
|
-
{
|
|
685
|
-
|
|
686
|
-
|
|
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",
|
|
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",
|
|
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: "
|
|
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
|
-
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
console.log(` ${mark.padEnd(22)} ${c.name}${
|
|
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 ---
|