claudemesh-cli 1.0.0-alpha.6 → 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.
- package/dist/entrypoints/cli.js +71 -28
- package/dist/entrypoints/cli.js.map +4 -4
- package/package.json +2 -2
package/dist/entrypoints/cli.js
CHANGED
|
@@ -608,14 +608,26 @@ async function loginWithDeviceCode() {
|
|
|
608
608
|
platform: device.platform,
|
|
609
609
|
arch: device.arch
|
|
610
610
|
});
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
log(
|
|
618
|
-
|
|
611
|
+
const url = `${verification_url}?code=${user_code}`;
|
|
612
|
+
const isTTY2 = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
613
|
+
const orange2 = (s) => isTTY2 ? `\x1B[38;5;208m${s}\x1B[0m` : s;
|
|
614
|
+
const bold2 = (s) => isTTY2 ? `\x1B[1m${s}\x1B[0m` : s;
|
|
615
|
+
const dim2 = (s) => isTTY2 ? `\x1B[2m${s}\x1B[0m` : s;
|
|
616
|
+
log("");
|
|
617
|
+
log(" " + orange2("claudemesh") + " — sign in to connect your terminal");
|
|
618
|
+
log("");
|
|
619
|
+
log(" ┌──────────────────────────────────┐");
|
|
620
|
+
log(" │ │");
|
|
621
|
+
log(" │ Your code: " + bold2(user_code) + " │");
|
|
622
|
+
log(" │ │");
|
|
623
|
+
log(" └──────────────────────────────────┘");
|
|
624
|
+
log("");
|
|
625
|
+
log(" " + dim2("Confirm this code matches your browser."));
|
|
626
|
+
log(" " + dim2("If your browser didn't open, visit:"));
|
|
627
|
+
log(" " + dim2(url));
|
|
628
|
+
log("");
|
|
629
|
+
log(" Waiting for confirmation… " + dim2("(Ctrl-C to cancel)"));
|
|
630
|
+
log("");
|
|
619
631
|
try {
|
|
620
632
|
await openBrowser(`${verification_url}?code=${user_code}`);
|
|
621
633
|
} catch {
|
|
@@ -1395,7 +1407,38 @@ var exports_login = {};
|
|
|
1395
1407
|
__export(exports_login, {
|
|
1396
1408
|
login: () => login
|
|
1397
1409
|
});
|
|
1410
|
+
import { createInterface } from "node:readline";
|
|
1398
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
|
+
}
|
|
1399
1442
|
try {
|
|
1400
1443
|
const result = await loginWithDeviceCode();
|
|
1401
1444
|
console.log(` ${green(icons.check)} Signed in as ${result.user.display_name}.`);
|
|
@@ -1437,13 +1480,13 @@ __export(exports_welcome, {
|
|
|
1437
1480
|
runWelcome: () => runWelcome,
|
|
1438
1481
|
_stub: () => runWelcome
|
|
1439
1482
|
});
|
|
1440
|
-
import { createInterface } from "node:readline";
|
|
1483
|
+
import { createInterface as createInterface2 } from "node:readline";
|
|
1441
1484
|
async function runWelcome() {
|
|
1442
1485
|
const config = readConfig();
|
|
1443
1486
|
if (config.meshes.length > 0)
|
|
1444
1487
|
return EXIT.SUCCESS;
|
|
1445
1488
|
renderWelcome();
|
|
1446
|
-
const rl =
|
|
1489
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
1447
1490
|
return new Promise((resolve) => {
|
|
1448
1491
|
rl.question(" Choice [1]: ", async (answer) => {
|
|
1449
1492
|
rl.close();
|
|
@@ -3505,7 +3548,7 @@ var init_facade9 = __esm(() => {
|
|
|
3505
3548
|
});
|
|
3506
3549
|
|
|
3507
3550
|
// src/ui/screen.ts
|
|
3508
|
-
import { createInterface as
|
|
3551
|
+
import { createInterface as createInterface3 } from "node:readline";
|
|
3509
3552
|
function termSize() {
|
|
3510
3553
|
return { cols: process.stdout.columns || 80, rows: process.stdout.rows || 24 };
|
|
3511
3554
|
}
|
|
@@ -3541,7 +3584,7 @@ async function menuSelect(itemsOrOpts, prompt = "Choice") {
|
|
|
3541
3584
|
${title}`);
|
|
3542
3585
|
items.forEach((item, i) => console.log(` ${bold(String(i + 1) + ")")} ${item}`));
|
|
3543
3586
|
console.log("");
|
|
3544
|
-
const rl =
|
|
3587
|
+
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
3545
3588
|
return new Promise((resolve) => {
|
|
3546
3589
|
rl.question(` ${prompt} [1]: `, (answer) => {
|
|
3547
3590
|
rl.close();
|
|
@@ -3553,7 +3596,7 @@ async function menuSelect(itemsOrOpts, prompt = "Choice") {
|
|
|
3553
3596
|
async function textInput(promptOrOpts, defaultVal = "") {
|
|
3554
3597
|
const label = typeof promptOrOpts === "string" ? promptOrOpts : promptOrOpts.label;
|
|
3555
3598
|
const placeholder = typeof promptOrOpts === "object" ? promptOrOpts.placeholder : undefined;
|
|
3556
|
-
const rl =
|
|
3599
|
+
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
3557
3600
|
return new Promise((resolve) => {
|
|
3558
3601
|
const hint = placeholder ? ` (${placeholder})` : defaultVal ? ` [${defaultVal}]` : "";
|
|
3559
3602
|
rl.question(` ${label}${hint}: `, (answer) => {
|
|
@@ -3565,7 +3608,7 @@ async function textInput(promptOrOpts, defaultVal = "") {
|
|
|
3565
3608
|
async function confirmPrompt(promptOrOpts, defaultYes = true) {
|
|
3566
3609
|
const message = typeof promptOrOpts === "string" ? promptOrOpts : promptOrOpts.message;
|
|
3567
3610
|
const defYes = typeof promptOrOpts === "object" && promptOrOpts.defaultYes !== undefined ? promptOrOpts.defaultYes : defaultYes;
|
|
3568
|
-
const rl =
|
|
3611
|
+
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
3569
3612
|
const hint = defYes ? "[Y/n]" : "[y/N]";
|
|
3570
3613
|
return new Promise((resolve) => {
|
|
3571
3614
|
rl.question(` ${message} ${hint}: `, (answer) => {
|
|
@@ -3680,7 +3723,7 @@ import { randomUUID } from "node:crypto";
|
|
|
3680
3723
|
import { mkdtempSync, writeFileSync as writeFileSync4, rmSync, readdirSync, statSync, existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
|
|
3681
3724
|
import { tmpdir, hostname as hostname3, homedir as homedir3 } from "node:os";
|
|
3682
3725
|
import { join as join3 } from "node:path";
|
|
3683
|
-
import { createInterface as
|
|
3726
|
+
import { createInterface as createInterface4 } from "node:readline";
|
|
3684
3727
|
async function pickMesh(meshes) {
|
|
3685
3728
|
if (meshes.length === 1)
|
|
3686
3729
|
return meshes[0];
|
|
@@ -3690,7 +3733,7 @@ async function pickMesh(meshes) {
|
|
|
3690
3733
|
console.log(` ${i + 1}) ${m.slug}`);
|
|
3691
3734
|
});
|
|
3692
3735
|
console.log("");
|
|
3693
|
-
const rl =
|
|
3736
|
+
const rl = createInterface4({ input: process.stdin, output: process.stdout });
|
|
3694
3737
|
return new Promise((resolve) => {
|
|
3695
3738
|
rl.question(" Choice [1]: ", (answer) => {
|
|
3696
3739
|
rl.close();
|
|
@@ -3932,7 +3975,7 @@ async function runLaunch(flags, rawArgs) {
|
|
|
3932
3975
|
console.log(` ${dim2(`Or join with invite: claudemesh launch --join <url>`)}
|
|
3933
3976
|
`);
|
|
3934
3977
|
const manualPromise = new Promise((resolve) => {
|
|
3935
|
-
const rl =
|
|
3978
|
+
const rl = createInterface4({ input: process.stdin, output: process.stdout });
|
|
3936
3979
|
rl.question(" Paste sync token (or wait for browser): ", (answer) => {
|
|
3937
3980
|
rl.close();
|
|
3938
3981
|
if (answer.trim())
|
|
@@ -7650,7 +7693,7 @@ var init_rename2 = __esm(() => {
|
|
|
7650
7693
|
|
|
7651
7694
|
// src/commands/connect.ts
|
|
7652
7695
|
import { hostname as hostname4 } from "node:os";
|
|
7653
|
-
import { createInterface as
|
|
7696
|
+
import { createInterface as createInterface5 } from "node:readline";
|
|
7654
7697
|
async function pickMesh2(meshes) {
|
|
7655
7698
|
console.log(`
|
|
7656
7699
|
Select mesh:`);
|
|
@@ -7658,7 +7701,7 @@ async function pickMesh2(meshes) {
|
|
|
7658
7701
|
console.log(` ${i + 1}) ${m.slug}`);
|
|
7659
7702
|
});
|
|
7660
7703
|
console.log("");
|
|
7661
|
-
const rl =
|
|
7704
|
+
const rl = createInterface5({ input: process.stdin, output: process.stdout });
|
|
7662
7705
|
return new Promise((resolve) => {
|
|
7663
7706
|
rl.question(" Choice [1]: ", (answer) => {
|
|
7664
7707
|
rl.close();
|
|
@@ -7716,7 +7759,7 @@ async function runPeers(flags) {
|
|
|
7716
7759
|
const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
|
|
7717
7760
|
const bold2 = (s) => useColor ? `\x1B[1m${s}\x1B[22m` : s;
|
|
7718
7761
|
const green3 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
|
|
7719
|
-
const
|
|
7762
|
+
const yellow3 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
|
|
7720
7763
|
const config = readConfig();
|
|
7721
7764
|
const slugs = flags.mesh ? [flags.mesh] : config.meshes.map((m) => m.slug);
|
|
7722
7765
|
if (slugs.length === 0) {
|
|
@@ -7739,7 +7782,7 @@ async function runPeers(flags) {
|
|
|
7739
7782
|
} else {
|
|
7740
7783
|
for (const p of peers) {
|
|
7741
7784
|
const groups = p.groups.length ? " [" + p.groups.map((g) => `@${g.name}${g.role ? `:${g.role}` : ""}`).join(", ") + "]" : "";
|
|
7742
|
-
const statusIcon = p.status === "working" ?
|
|
7785
|
+
const statusIcon = p.status === "working" ? yellow3("●") : green3("●");
|
|
7743
7786
|
const name = bold2(p.displayName);
|
|
7744
7787
|
const meta = [];
|
|
7745
7788
|
if (p.peerType)
|
|
@@ -8744,7 +8787,7 @@ function runInstall(args = []) {
|
|
|
8744
8787
|
}
|
|
8745
8788
|
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
8746
8789
|
const bold2 = (s) => useColor ? `\x1B[1m${s}\x1B[22m` : s;
|
|
8747
|
-
const
|
|
8790
|
+
const yellow3 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
|
|
8748
8791
|
const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
|
|
8749
8792
|
console.log(`✓ MCP server "${MCP_NAME}" ${action}`);
|
|
8750
8793
|
console.log(dim2(` config: ${CLAUDE_CONFIG}`));
|
|
@@ -8784,10 +8827,10 @@ function runInstall(args = []) {
|
|
|
8784
8827
|
hasMeshes = meshConfig.meshes.length > 0;
|
|
8785
8828
|
} catch {}
|
|
8786
8829
|
console.log("");
|
|
8787
|
-
console.log(
|
|
8830
|
+
console.log(yellow3(bold2("⚠ RESTART CLAUDE CODE")) + yellow3(" for MCP tools to appear."));
|
|
8788
8831
|
if (!hasMeshes) {
|
|
8789
8832
|
console.log("");
|
|
8790
|
-
console.log(
|
|
8833
|
+
console.log(yellow3("No meshes joined.") + " To connect with peers:");
|
|
8791
8834
|
console.log(` ${bold2("claudemesh join <invite-url>")}` + dim2(" — join an existing mesh"));
|
|
8792
8835
|
console.log(` ${dim2("Create one at")} ${bold2("https://claudemesh.com/dashboard")}`);
|
|
8793
8836
|
} else {
|
|
@@ -8795,7 +8838,7 @@ function runInstall(args = []) {
|
|
|
8795
8838
|
console.log(`Next: ${bold2("claudemesh join https://claudemesh.com/join/<token>")}`);
|
|
8796
8839
|
}
|
|
8797
8840
|
console.log("");
|
|
8798
|
-
console.log(
|
|
8841
|
+
console.log(yellow3("⚠ For real-time push messages from peers, launch with:"));
|
|
8799
8842
|
console.log(` ${bold2("claudemesh launch")}` + dim2(" (or: claude --dangerously-load-development-channels server:claudemesh)"));
|
|
8800
8843
|
console.log(dim2(" Plain `claude` still works — messages are then pull-only via check_messages."));
|
|
8801
8844
|
}
|
|
@@ -8953,7 +8996,7 @@ var exports_sync = {};
|
|
|
8953
8996
|
__export(exports_sync, {
|
|
8954
8997
|
runSync: () => runSync
|
|
8955
8998
|
});
|
|
8956
|
-
import { createInterface as
|
|
8999
|
+
import { createInterface as createInterface6 } from "node:readline";
|
|
8957
9000
|
import { hostname as hostname5 } from "node:os";
|
|
8958
9001
|
async function runSync(args) {
|
|
8959
9002
|
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
@@ -8967,7 +9010,7 @@ async function runSync(args) {
|
|
|
8967
9010
|
console.log(dim2(`Visit: ${url}`));
|
|
8968
9011
|
await openBrowser(url);
|
|
8969
9012
|
const manualPromise = new Promise((resolve2) => {
|
|
8970
|
-
const rl =
|
|
9013
|
+
const rl = createInterface6({ input: process.stdin, output: process.stdout });
|
|
8971
9014
|
rl.question("Paste sync token (or wait for browser): ", (answer) => {
|
|
8972
9015
|
rl.close();
|
|
8973
9016
|
if (answer.trim())
|
|
@@ -10602,4 +10645,4 @@ main().catch((err) => {
|
|
|
10602
10645
|
process.exit(EXIT.INTERNAL_ERROR);
|
|
10603
10646
|
});
|
|
10604
10647
|
|
|
10605
|
-
//# debugId=
|
|
10648
|
+
//# debugId=A2CF6E1117A2110D64756E2164756E21
|