@0dai-dev/cli 3.1.4 → 3.1.5

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 +47 -3
  2. package/package.json +1 -1
package/bin/0dai.js CHANGED
@@ -391,7 +391,12 @@ async function cmdInit(target, args = []) {
391
391
  });
392
392
 
393
393
  if (result.error) {
394
- if (result.hint) {
394
+ if (result.error.includes("authentication")) {
395
+ log(`authentication required`);
396
+ console.log(` 0dai auth is separate from your agent CLIs (Claude Code, Codex).`);
397
+ console.log(` It tracks projects, usage limits, and team features.\n`);
398
+ console.log(` ${D}Run: 0dai auth login${R}`);
399
+ } else if (result.hint) {
395
400
  log(`${result.message || result.error}`);
396
401
  console.log(` ${result.hint}\n`);
397
402
  } else {
@@ -499,7 +504,17 @@ async function cmdSync(target, args = []) {
499
504
  dry_run: dryRun, quiet,
500
505
  });
501
506
 
502
- if (result.error) { log(`error: ${result.error}`); process.exit(1); }
507
+ if (result.error) {
508
+ if (result.error.includes("authentication")) {
509
+ log(`authentication required`);
510
+ console.log(` 0dai auth is separate from your agent CLIs (Claude Code, Codex).`);
511
+ console.log(` It tracks projects, usage limits, and team features.\n`);
512
+ console.log(` ${D}Run: 0dai auth login${R}`);
513
+ } else {
514
+ log(`error: ${result.error}`);
515
+ }
516
+ process.exit(1);
517
+ }
503
518
 
504
519
  const updated = result.files_updated || {};
505
520
  if (dryRun) {
@@ -1247,10 +1262,38 @@ async function checkVersion() {
1247
1262
  async function cmdAuthLogin() {
1248
1263
  const isTTY = process.stdout.isTTY && process.stdin.isTTY;
1249
1264
 
1265
+ // Check if already authenticated
1266
+ try {
1267
+ const existing = JSON.parse(fs.readFileSync(AUTH_FILE, "utf8"));
1268
+ if (existing.access_token || existing.email) {
1269
+ if (isTTY) {
1270
+ const p = require("@clack/prompts");
1271
+ p.intro(`${T}0dai${R} authentication`);
1272
+ p.log.success(`Already logged in as ${T}${existing.email || "unknown"}${R} (${existing.plan || "free"} plan)`);
1273
+ const reauth = await p.confirm({ message: "Sign in with a different account?" });
1274
+ if (p.isCancel(reauth) || !reauth) {
1275
+ p.outro("Current session kept");
1276
+ return;
1277
+ }
1278
+ } else {
1279
+ log(`Already logged in as ${existing.email || "unknown"} (${existing.plan || "free"} plan)`);
1280
+ log("To switch accounts, delete ~/.0dai/auth.json and run again");
1281
+ return;
1282
+ }
1283
+ }
1284
+ } catch {}
1285
+
1250
1286
  if (isTTY) {
1251
1287
  // Interactive TUI flow
1252
1288
  const p = require("@clack/prompts");
1253
- p.intro(`${T}0dai${R} authentication`);
1289
+ if (!p._intro_shown) p.intro(`${T}0dai${R} authentication`);
1290
+
1291
+ p.note(
1292
+ "0dai auth is separate from agent CLIs (Claude Code, Codex).\n" +
1293
+ "It tracks your projects, usage limits, and team features.\n" +
1294
+ "Your agent CLIs keep their own auth (subscription/API key).",
1295
+ "Why sign in?"
1296
+ );
1254
1297
 
1255
1298
  const method = await p.select({
1256
1299
  message: "How would you like to sign in?",
@@ -1344,6 +1387,7 @@ async function cmdAuthLogin() {
1344
1387
 
1345
1388
  } else {
1346
1389
  // Non-interactive: device code only
1390
+ log("0dai auth is separate from agent CLIs. It tracks projects, limits, and team features.");
1347
1391
  const result = await apiCall("/v1/auth/device", { client_id: "cli" });
1348
1392
  if (result.error) { log(`error: ${result.error}`); process.exit(1); }
1349
1393
  log(`Open: ${result.verification_uri}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0dai-dev/cli",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
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"