@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.
- package/bin/0dai.js +58 -11
- 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
|
-
|
|
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
|
-
{
|
|
685
|
-
|
|
686
|
-
|
|
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",
|
|
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",
|
|
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: "
|
|
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
|
-
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
console.log(` ${mark.padEnd(22)} ${c.name}${
|
|
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 ---
|