claudemesh-cli 1.0.0-alpha.7 → 1.0.0-alpha.8

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.
@@ -1407,7 +1407,38 @@ var exports_login = {};
1407
1407
  __export(exports_login, {
1408
1408
  login: () => login
1409
1409
  });
1410
+ import { createInterface } from "node:readline";
1410
1411
  async function login() {
1412
+ const existing = getStoredToken();
1413
+ if (existing) {
1414
+ const name = existing.user.display_name || existing.user.email || "unknown";
1415
+ console.log(`
1416
+ Already signed in as ${bold(name)}.`);
1417
+ console.log("");
1418
+ console.log(` ${bold("1)")} Continue as ${name}`);
1419
+ console.log(` ${bold("2)")} Sign in as a different account`);
1420
+ console.log(` ${bold("3)")} Sign out ${dim("(claudemesh logout)")}`);
1421
+ console.log("");
1422
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
1423
+ const choice = await new Promise((resolve) => {
1424
+ rl.question(" Choice [1]: ", (answer) => {
1425
+ rl.close();
1426
+ resolve(answer.trim() || "1");
1427
+ });
1428
+ });
1429
+ if (choice === "1") {
1430
+ console.log(`
1431
+ ${green(icons.check)} Continuing as ${name}.`);
1432
+ return EXIT.SUCCESS;
1433
+ }
1434
+ if (choice === "3") {
1435
+ clearToken();
1436
+ console.log(` ${green(icons.check)} Signed out.`);
1437
+ return EXIT.SUCCESS;
1438
+ }
1439
+ clearToken();
1440
+ console.log(` ${dim("Signing in as a different account…")}`);
1441
+ }
1411
1442
  try {
1412
1443
  const result = await loginWithDeviceCode();
1413
1444
  console.log(` ${green(icons.check)} Signed in as ${result.user.display_name}.`);
@@ -1449,13 +1480,13 @@ __export(exports_welcome, {
1449
1480
  runWelcome: () => runWelcome,
1450
1481
  _stub: () => runWelcome
1451
1482
  });
1452
- import { createInterface } from "node:readline";
1483
+ import { createInterface as createInterface2 } from "node:readline";
1453
1484
  async function runWelcome() {
1454
1485
  const config = readConfig();
1455
1486
  if (config.meshes.length > 0)
1456
1487
  return EXIT.SUCCESS;
1457
1488
  renderWelcome();
1458
- const rl = createInterface({ input: process.stdin, output: process.stdout });
1489
+ const rl = createInterface2({ input: process.stdin, output: process.stdout });
1459
1490
  return new Promise((resolve) => {
1460
1491
  rl.question(" Choice [1]: ", async (answer) => {
1461
1492
  rl.close();
@@ -3517,7 +3548,7 @@ var init_facade9 = __esm(() => {
3517
3548
  });
3518
3549
 
3519
3550
  // src/ui/screen.ts
3520
- import { createInterface as createInterface2 } from "node:readline";
3551
+ import { createInterface as createInterface3 } from "node:readline";
3521
3552
  function termSize() {
3522
3553
  return { cols: process.stdout.columns || 80, rows: process.stdout.rows || 24 };
3523
3554
  }
@@ -3553,7 +3584,7 @@ async function menuSelect(itemsOrOpts, prompt = "Choice") {
3553
3584
  ${title}`);
3554
3585
  items.forEach((item, i) => console.log(` ${bold(String(i + 1) + ")")} ${item}`));
3555
3586
  console.log("");
3556
- const rl = createInterface2({ input: process.stdin, output: process.stdout });
3587
+ const rl = createInterface3({ input: process.stdin, output: process.stdout });
3557
3588
  return new Promise((resolve) => {
3558
3589
  rl.question(` ${prompt} [1]: `, (answer) => {
3559
3590
  rl.close();
@@ -3565,7 +3596,7 @@ async function menuSelect(itemsOrOpts, prompt = "Choice") {
3565
3596
  async function textInput(promptOrOpts, defaultVal = "") {
3566
3597
  const label = typeof promptOrOpts === "string" ? promptOrOpts : promptOrOpts.label;
3567
3598
  const placeholder = typeof promptOrOpts === "object" ? promptOrOpts.placeholder : undefined;
3568
- const rl = createInterface2({ input: process.stdin, output: process.stdout });
3599
+ const rl = createInterface3({ input: process.stdin, output: process.stdout });
3569
3600
  return new Promise((resolve) => {
3570
3601
  const hint = placeholder ? ` (${placeholder})` : defaultVal ? ` [${defaultVal}]` : "";
3571
3602
  rl.question(` ${label}${hint}: `, (answer) => {
@@ -3577,7 +3608,7 @@ async function textInput(promptOrOpts, defaultVal = "") {
3577
3608
  async function confirmPrompt(promptOrOpts, defaultYes = true) {
3578
3609
  const message = typeof promptOrOpts === "string" ? promptOrOpts : promptOrOpts.message;
3579
3610
  const defYes = typeof promptOrOpts === "object" && promptOrOpts.defaultYes !== undefined ? promptOrOpts.defaultYes : defaultYes;
3580
- const rl = createInterface2({ input: process.stdin, output: process.stdout });
3611
+ const rl = createInterface3({ input: process.stdin, output: process.stdout });
3581
3612
  const hint = defYes ? "[Y/n]" : "[y/N]";
3582
3613
  return new Promise((resolve) => {
3583
3614
  rl.question(` ${message} ${hint}: `, (answer) => {
@@ -3692,7 +3723,7 @@ import { randomUUID } from "node:crypto";
3692
3723
  import { mkdtempSync, writeFileSync as writeFileSync4, rmSync, readdirSync, statSync, existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
3693
3724
  import { tmpdir, hostname as hostname3, homedir as homedir3 } from "node:os";
3694
3725
  import { join as join3 } from "node:path";
3695
- import { createInterface as createInterface3 } from "node:readline";
3726
+ import { createInterface as createInterface4 } from "node:readline";
3696
3727
  async function pickMesh(meshes) {
3697
3728
  if (meshes.length === 1)
3698
3729
  return meshes[0];
@@ -3702,7 +3733,7 @@ async function pickMesh(meshes) {
3702
3733
  console.log(` ${i + 1}) ${m.slug}`);
3703
3734
  });
3704
3735
  console.log("");
3705
- const rl = createInterface3({ input: process.stdin, output: process.stdout });
3736
+ const rl = createInterface4({ input: process.stdin, output: process.stdout });
3706
3737
  return new Promise((resolve) => {
3707
3738
  rl.question(" Choice [1]: ", (answer) => {
3708
3739
  rl.close();
@@ -3944,7 +3975,7 @@ async function runLaunch(flags, rawArgs) {
3944
3975
  console.log(` ${dim2(`Or join with invite: claudemesh launch --join <url>`)}
3945
3976
  `);
3946
3977
  const manualPromise = new Promise((resolve) => {
3947
- const rl = createInterface3({ input: process.stdin, output: process.stdout });
3978
+ const rl = createInterface4({ input: process.stdin, output: process.stdout });
3948
3979
  rl.question(" Paste sync token (or wait for browser): ", (answer) => {
3949
3980
  rl.close();
3950
3981
  if (answer.trim())
@@ -7662,7 +7693,7 @@ var init_rename2 = __esm(() => {
7662
7693
 
7663
7694
  // src/commands/connect.ts
7664
7695
  import { hostname as hostname4 } from "node:os";
7665
- import { createInterface as createInterface4 } from "node:readline";
7696
+ import { createInterface as createInterface5 } from "node:readline";
7666
7697
  async function pickMesh2(meshes) {
7667
7698
  console.log(`
7668
7699
  Select mesh:`);
@@ -7670,7 +7701,7 @@ async function pickMesh2(meshes) {
7670
7701
  console.log(` ${i + 1}) ${m.slug}`);
7671
7702
  });
7672
7703
  console.log("");
7673
- const rl = createInterface4({ input: process.stdin, output: process.stdout });
7704
+ const rl = createInterface5({ input: process.stdin, output: process.stdout });
7674
7705
  return new Promise((resolve) => {
7675
7706
  rl.question(" Choice [1]: ", (answer) => {
7676
7707
  rl.close();
@@ -7728,7 +7759,7 @@ async function runPeers(flags) {
7728
7759
  const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
7729
7760
  const bold2 = (s) => useColor ? `\x1B[1m${s}\x1B[22m` : s;
7730
7761
  const green3 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
7731
- const yellow2 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
7762
+ const yellow3 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
7732
7763
  const config = readConfig();
7733
7764
  const slugs = flags.mesh ? [flags.mesh] : config.meshes.map((m) => m.slug);
7734
7765
  if (slugs.length === 0) {
@@ -7751,7 +7782,7 @@ async function runPeers(flags) {
7751
7782
  } else {
7752
7783
  for (const p of peers) {
7753
7784
  const groups = p.groups.length ? " [" + p.groups.map((g) => `@${g.name}${g.role ? `:${g.role}` : ""}`).join(", ") + "]" : "";
7754
- const statusIcon = p.status === "working" ? yellow2("●") : green3("●");
7785
+ const statusIcon = p.status === "working" ? yellow3("●") : green3("●");
7755
7786
  const name = bold2(p.displayName);
7756
7787
  const meta = [];
7757
7788
  if (p.peerType)
@@ -8756,7 +8787,7 @@ function runInstall(args = []) {
8756
8787
  }
8757
8788
  const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
8758
8789
  const bold2 = (s) => useColor ? `\x1B[1m${s}\x1B[22m` : s;
8759
- const yellow2 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
8790
+ const yellow3 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
8760
8791
  const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
8761
8792
  console.log(`✓ MCP server "${MCP_NAME}" ${action}`);
8762
8793
  console.log(dim2(` config: ${CLAUDE_CONFIG}`));
@@ -8796,10 +8827,10 @@ function runInstall(args = []) {
8796
8827
  hasMeshes = meshConfig.meshes.length > 0;
8797
8828
  } catch {}
8798
8829
  console.log("");
8799
- console.log(yellow2(bold2("⚠ RESTART CLAUDE CODE")) + yellow2(" for MCP tools to appear."));
8830
+ console.log(yellow3(bold2("⚠ RESTART CLAUDE CODE")) + yellow3(" for MCP tools to appear."));
8800
8831
  if (!hasMeshes) {
8801
8832
  console.log("");
8802
- console.log(yellow2("No meshes joined.") + " To connect with peers:");
8833
+ console.log(yellow3("No meshes joined.") + " To connect with peers:");
8803
8834
  console.log(` ${bold2("claudemesh join <invite-url>")}` + dim2(" — join an existing mesh"));
8804
8835
  console.log(` ${dim2("Create one at")} ${bold2("https://claudemesh.com/dashboard")}`);
8805
8836
  } else {
@@ -8807,7 +8838,7 @@ function runInstall(args = []) {
8807
8838
  console.log(`Next: ${bold2("claudemesh join https://claudemesh.com/join/<token>")}`);
8808
8839
  }
8809
8840
  console.log("");
8810
- console.log(yellow2("⚠ For real-time push messages from peers, launch with:"));
8841
+ console.log(yellow3("⚠ For real-time push messages from peers, launch with:"));
8811
8842
  console.log(` ${bold2("claudemesh launch")}` + dim2(" (or: claude --dangerously-load-development-channels server:claudemesh)"));
8812
8843
  console.log(dim2(" Plain `claude` still works — messages are then pull-only via check_messages."));
8813
8844
  }
@@ -8965,7 +8996,7 @@ var exports_sync = {};
8965
8996
  __export(exports_sync, {
8966
8997
  runSync: () => runSync
8967
8998
  });
8968
- import { createInterface as createInterface5 } from "node:readline";
8999
+ import { createInterface as createInterface6 } from "node:readline";
8969
9000
  import { hostname as hostname5 } from "node:os";
8970
9001
  async function runSync(args) {
8971
9002
  const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
@@ -8979,7 +9010,7 @@ async function runSync(args) {
8979
9010
  console.log(dim2(`Visit: ${url}`));
8980
9011
  await openBrowser(url);
8981
9012
  const manualPromise = new Promise((resolve2) => {
8982
- const rl = createInterface5({ input: process.stdin, output: process.stdout });
9013
+ const rl = createInterface6({ input: process.stdin, output: process.stdout });
8983
9014
  rl.question("Paste sync token (or wait for browser): ", (answer) => {
8984
9015
  rl.close();
8985
9016
  if (answer.trim())
@@ -10614,4 +10645,4 @@ main().catch((err) => {
10614
10645
  process.exit(EXIT.INTERNAL_ERROR);
10615
10646
  });
10616
10647
 
10617
- //# debugId=1511E5E3A793570664756E2164756E21
10648
+ //# debugId=A2CF6E1117A2110D64756E2164756E21