claudemesh-cli 1.0.0-alpha.12 → 1.0.0-alpha.14
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 +182 -75
- package/dist/entrypoints/cli.js.map +6 -6
- package/package.json +3 -3
package/dist/entrypoints/cli.js
CHANGED
|
@@ -614,14 +614,31 @@ var init_errors2 = __esm(() => {
|
|
|
614
614
|
});
|
|
615
615
|
|
|
616
616
|
// src/services/auth/device-code.ts
|
|
617
|
+
import { createInterface } from "node:readline";
|
|
618
|
+
function parseJwtUser(token) {
|
|
619
|
+
try {
|
|
620
|
+
const parts = token.split(".");
|
|
621
|
+
if (parts[1]) {
|
|
622
|
+
const payload = JSON.parse(Buffer.from(parts[1], "base64url").toString());
|
|
623
|
+
if (payload.exp && payload.exp < Date.now() / 1000)
|
|
624
|
+
throw new Error("expired");
|
|
625
|
+
return {
|
|
626
|
+
id: payload.sub ?? "",
|
|
627
|
+
display_name: payload.name ?? payload.email ?? "",
|
|
628
|
+
email: payload.email ?? ""
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
} catch {}
|
|
632
|
+
throw new Error("Invalid token");
|
|
633
|
+
}
|
|
617
634
|
async function loginWithDeviceCode() {
|
|
618
635
|
const device = getDeviceInfo();
|
|
619
|
-
const { device_code, user_code, verification_url } = await exports_public.requestDeviceCode({
|
|
636
|
+
const { device_code, user_code, session_id, verification_url, token_url } = await exports_public.requestDeviceCode({
|
|
620
637
|
hostname: device.hostname,
|
|
621
638
|
platform: device.platform,
|
|
622
639
|
arch: device.arch
|
|
623
640
|
});
|
|
624
|
-
const
|
|
641
|
+
const browserUrl = `${verification_url}?session=${session_id}`;
|
|
625
642
|
const isTTY2 = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
626
643
|
const orange2 = (s) => isTTY2 ? `\x1B[38;5;208m${s}\x1B[0m` : s;
|
|
627
644
|
const bold2 = (s) => isTTY2 ? `\x1B[1m${s}\x1B[0m` : s;
|
|
@@ -636,38 +653,74 @@ async function loginWithDeviceCode() {
|
|
|
636
653
|
log(" └──────────────────────────────────┘");
|
|
637
654
|
log("");
|
|
638
655
|
log(" " + dim2("Confirm this code matches your browser."));
|
|
639
|
-
log(" " + dim2("If your browser didn't open, visit:"));
|
|
640
|
-
log(" " + dim2(url));
|
|
641
656
|
log("");
|
|
642
|
-
log("
|
|
657
|
+
log(" " + dim2("If the browser didn't open, visit:"));
|
|
658
|
+
log(" " + browserUrl);
|
|
659
|
+
log("");
|
|
660
|
+
log(" " + dim2("Can't use a browser? Generate a token at:"));
|
|
661
|
+
log(" " + (token_url || verification_url.replace("/cli-auth", "/token")));
|
|
662
|
+
log(" " + dim2("Then paste it below."));
|
|
643
663
|
log("");
|
|
664
|
+
log(" Waiting… " + dim2("(paste token or Ctrl-C to cancel)"));
|
|
644
665
|
try {
|
|
645
|
-
await openBrowser(
|
|
666
|
+
await openBrowser(browserUrl);
|
|
646
667
|
} catch {
|
|
647
|
-
warn("Could not open browser automatically.");
|
|
668
|
+
warn(" Could not open browser automatically.");
|
|
648
669
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
670
|
+
return new Promise((resolve, reject) => {
|
|
671
|
+
let done = false;
|
|
672
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
673
|
+
rl.on("line", (line) => {
|
|
674
|
+
if (done)
|
|
675
|
+
return;
|
|
676
|
+
const trimmed = line.trim();
|
|
677
|
+
if (trimmed.split(".").length === 3 && trimmed.length > 50) {
|
|
678
|
+
done = true;
|
|
679
|
+
rl.close();
|
|
680
|
+
try {
|
|
681
|
+
const user = parseJwtUser(trimmed);
|
|
682
|
+
storeToken({ session_token: trimmed, user, token_source: "manual" });
|
|
683
|
+
resolve({ user, session_token: trimmed });
|
|
684
|
+
} catch (e) {
|
|
685
|
+
reject(new Error("Invalid or expired token. Generate a new one."));
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
const startTime = Date.now();
|
|
690
|
+
const poll = async () => {
|
|
691
|
+
while (!done && Date.now() - startTime < TIMINGS.DEVICE_CODE_TIMEOUT_MS) {
|
|
692
|
+
await new Promise((r) => setTimeout(r, TIMINGS.DEVICE_CODE_POLL_MS));
|
|
693
|
+
if (done)
|
|
694
|
+
return;
|
|
695
|
+
try {
|
|
696
|
+
const result = await exports_public.pollDeviceCode(device_code);
|
|
697
|
+
if (result.status === "approved" && result.session_token && result.user) {
|
|
698
|
+
if (done)
|
|
699
|
+
return;
|
|
700
|
+
done = true;
|
|
701
|
+
rl.close();
|
|
702
|
+
storeToken({ session_token: result.session_token, user: result.user, token_source: "device-code" });
|
|
703
|
+
resolve({ user: result.user, session_token: result.session_token });
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
if (result.status === "expired") {
|
|
707
|
+
if (done)
|
|
708
|
+
return;
|
|
709
|
+
done = true;
|
|
710
|
+
rl.close();
|
|
711
|
+
reject(new DeviceCodeExpired);
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
} catch {}
|
|
715
|
+
}
|
|
716
|
+
if (!done) {
|
|
717
|
+
done = true;
|
|
718
|
+
rl.close();
|
|
719
|
+
reject(new DeviceCodeExpired);
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
poll();
|
|
723
|
+
});
|
|
671
724
|
}
|
|
672
725
|
var init_device_code = __esm(() => {
|
|
673
726
|
init_timings();
|
|
@@ -3548,7 +3601,7 @@ var init_facade11 = __esm(() => {
|
|
|
3548
3601
|
});
|
|
3549
3602
|
|
|
3550
3603
|
// src/ui/screen.ts
|
|
3551
|
-
import { createInterface } from "node:readline";
|
|
3604
|
+
import { createInterface as createInterface2 } from "node:readline";
|
|
3552
3605
|
function termSize() {
|
|
3553
3606
|
return { cols: process.stdout.columns || 80, rows: process.stdout.rows || 24 };
|
|
3554
3607
|
}
|
|
@@ -3584,7 +3637,7 @@ async function menuSelect(itemsOrOpts, prompt = "Choice") {
|
|
|
3584
3637
|
${title}`);
|
|
3585
3638
|
items.forEach((item, i) => console.log(` ${bold(String(i + 1) + ")")} ${item}`));
|
|
3586
3639
|
console.log("");
|
|
3587
|
-
const rl =
|
|
3640
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
3588
3641
|
return new Promise((resolve) => {
|
|
3589
3642
|
rl.question(` ${prompt} [1]: `, (answer) => {
|
|
3590
3643
|
rl.close();
|
|
@@ -3596,7 +3649,7 @@ async function menuSelect(itemsOrOpts, prompt = "Choice") {
|
|
|
3596
3649
|
async function textInput(promptOrOpts, defaultVal = "") {
|
|
3597
3650
|
const label = typeof promptOrOpts === "string" ? promptOrOpts : promptOrOpts.label;
|
|
3598
3651
|
const placeholder = typeof promptOrOpts === "object" ? promptOrOpts.placeholder : undefined;
|
|
3599
|
-
const rl =
|
|
3652
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
3600
3653
|
return new Promise((resolve) => {
|
|
3601
3654
|
const hint = placeholder ? ` (${placeholder})` : defaultVal ? ` [${defaultVal}]` : "";
|
|
3602
3655
|
rl.question(` ${label}${hint}: `, (answer) => {
|
|
@@ -3608,7 +3661,7 @@ async function textInput(promptOrOpts, defaultVal = "") {
|
|
|
3608
3661
|
async function confirmPrompt(promptOrOpts, defaultYes = true) {
|
|
3609
3662
|
const message = typeof promptOrOpts === "string" ? promptOrOpts : promptOrOpts.message;
|
|
3610
3663
|
const defYes = typeof promptOrOpts === "object" && promptOrOpts.defaultYes !== undefined ? promptOrOpts.defaultYes : defaultYes;
|
|
3611
|
-
const rl =
|
|
3664
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
3612
3665
|
const hint = defYes ? "[Y/n]" : "[y/N]";
|
|
3613
3666
|
return new Promise((resolve) => {
|
|
3614
3667
|
rl.question(` ${message} ${hint}: `, (answer) => {
|
|
@@ -3723,7 +3776,7 @@ import { randomUUID } from "node:crypto";
|
|
|
3723
3776
|
import { mkdtempSync, writeFileSync as writeFileSync4, rmSync, readdirSync, statSync, existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
|
|
3724
3777
|
import { tmpdir, hostname as hostname3, homedir as homedir3 } from "node:os";
|
|
3725
3778
|
import { join as join3 } from "node:path";
|
|
3726
|
-
import { createInterface as
|
|
3779
|
+
import { createInterface as createInterface3 } from "node:readline";
|
|
3727
3780
|
async function pickMesh(meshes) {
|
|
3728
3781
|
if (meshes.length === 1)
|
|
3729
3782
|
return meshes[0];
|
|
@@ -3733,7 +3786,7 @@ async function pickMesh(meshes) {
|
|
|
3733
3786
|
console.log(` ${i + 1}) ${m.slug}`);
|
|
3734
3787
|
});
|
|
3735
3788
|
console.log("");
|
|
3736
|
-
const rl =
|
|
3789
|
+
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
3737
3790
|
return new Promise((resolve) => {
|
|
3738
3791
|
rl.question(" Choice [1]: ", (answer) => {
|
|
3739
3792
|
rl.close();
|
|
@@ -3975,7 +4028,7 @@ async function runLaunch(flags, rawArgs) {
|
|
|
3975
4028
|
console.log(` ${dim2(`Or join with invite: claudemesh launch --join <url>`)}
|
|
3976
4029
|
`);
|
|
3977
4030
|
const manualPromise = new Promise((resolve) => {
|
|
3978
|
-
const rl =
|
|
4031
|
+
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
3979
4032
|
rl.question(" Paste sync token (or wait for browser): ", (answer) => {
|
|
3980
4033
|
rl.close();
|
|
3981
4034
|
if (answer.trim())
|
|
@@ -4278,30 +4331,84 @@ var exports_list = {};
|
|
|
4278
4331
|
__export(exports_list, {
|
|
4279
4332
|
runList: () => runList
|
|
4280
4333
|
});
|
|
4281
|
-
function runList() {
|
|
4334
|
+
async function runList() {
|
|
4282
4335
|
const config = readConfig();
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4336
|
+
const auth = getStoredToken();
|
|
4337
|
+
let serverMeshes = [];
|
|
4338
|
+
if (auth) {
|
|
4339
|
+
try {
|
|
4340
|
+
let userId = "";
|
|
4341
|
+
try {
|
|
4342
|
+
const payload = JSON.parse(Buffer.from(auth.session_token.split(".")[1], "base64url").toString());
|
|
4343
|
+
userId = payload.sub ?? "";
|
|
4344
|
+
} catch {}
|
|
4345
|
+
if (userId) {
|
|
4346
|
+
const res = await request({
|
|
4347
|
+
path: `/cli/meshes?user_id=${userId}`,
|
|
4348
|
+
baseUrl: BROKER_HTTP2
|
|
4349
|
+
});
|
|
4350
|
+
serverMeshes = res.meshes ?? [];
|
|
4351
|
+
}
|
|
4352
|
+
} catch {}
|
|
4353
|
+
}
|
|
4354
|
+
const localSlugs = new Set(config.meshes.map((m) => m.slug));
|
|
4355
|
+
const serverSlugs = new Set(serverMeshes.map((m) => m.slug));
|
|
4356
|
+
const allSlugs = new Set([...localSlugs, ...serverSlugs]);
|
|
4357
|
+
if (allSlugs.size === 0) {
|
|
4358
|
+
console.log(`
|
|
4359
|
+
No meshes yet.
|
|
4360
|
+
`);
|
|
4361
|
+
console.log(" Create one: claudemesh mesh create <name>");
|
|
4362
|
+
console.log(` Join one: claudemesh mesh add <invite-url>
|
|
4363
|
+
`);
|
|
4288
4364
|
return;
|
|
4289
4365
|
}
|
|
4290
|
-
console.log(`
|
|
4366
|
+
console.log(`
|
|
4367
|
+
Your meshes:
|
|
4368
|
+
`);
|
|
4369
|
+
for (const slug of allSlugs) {
|
|
4370
|
+
const local = config.meshes.find((m) => m.slug === slug);
|
|
4371
|
+
const server = serverMeshes.find((m) => m.slug === slug);
|
|
4372
|
+
const name = server?.name ?? local?.name ?? slug;
|
|
4373
|
+
const role = server?.role ?? "member";
|
|
4374
|
+
const isOwner = server?.is_owner ?? false;
|
|
4375
|
+
const roleLabel = isOwner ? "owner" : role;
|
|
4376
|
+
const memberCount = server?.member_count;
|
|
4377
|
+
const activePeers = server?.active_peers ?? 0;
|
|
4378
|
+
const inLocal = localSlugs.has(slug);
|
|
4379
|
+
const inServer = serverSlugs.has(slug);
|
|
4380
|
+
let status;
|
|
4381
|
+
let icon;
|
|
4382
|
+
if (inLocal && inServer) {
|
|
4383
|
+
icon = green("●");
|
|
4384
|
+
status = activePeers > 0 ? green(`${activePeers} online`) : dim("synced");
|
|
4385
|
+
} else if (inLocal && !inServer) {
|
|
4386
|
+
icon = yellow("●");
|
|
4387
|
+
status = yellow("local only");
|
|
4388
|
+
} else {
|
|
4389
|
+
icon = dim("○");
|
|
4390
|
+
status = dim("not added locally");
|
|
4391
|
+
}
|
|
4392
|
+
const memberInfo = memberCount ? dim(`${memberCount} member${memberCount !== 1 ? "s" : ""}`) : "";
|
|
4393
|
+
const parts = [roleLabel, memberInfo, status].filter(Boolean);
|
|
4394
|
+
console.log(` ${icon} ${bold(name)} ${dim(slug)}`);
|
|
4395
|
+
console.log(` ${parts.join(" · ")}`);
|
|
4396
|
+
}
|
|
4291
4397
|
console.log("");
|
|
4292
|
-
|
|
4293
|
-
console.log(`
|
|
4294
|
-
console.log(` mesh id: ${m.meshId}`);
|
|
4295
|
-
console.log(` member id: ${m.memberId}`);
|
|
4296
|
-
console.log(` pubkey: ${m.pubkey.slice(0, 16)}…`);
|
|
4297
|
-
console.log(` broker: ${m.brokerUrl}`);
|
|
4298
|
-
console.log(` joined: ${m.joinedAt}`);
|
|
4299
|
-
console.log("");
|
|
4398
|
+
if (serverMeshes.some((m) => !localSlugs.has(m.slug))) {
|
|
4399
|
+
console.log(dim(" ○ = server only — run `claudemesh mesh add` to use locally"));
|
|
4300
4400
|
}
|
|
4301
|
-
console.log(`Config: ${getConfigPath()}`);
|
|
4401
|
+
console.log(dim(` Config: ${getConfigPath()}`));
|
|
4402
|
+
console.log("");
|
|
4302
4403
|
}
|
|
4404
|
+
var BROKER_HTTP2;
|
|
4303
4405
|
var init_list2 = __esm(() => {
|
|
4304
4406
|
init_facade();
|
|
4407
|
+
init_facade6();
|
|
4408
|
+
init_facade3();
|
|
4409
|
+
init_urls();
|
|
4410
|
+
init_styles();
|
|
4411
|
+
BROKER_HTTP2 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
|
|
4305
4412
|
});
|
|
4306
4413
|
|
|
4307
4414
|
// src/commands/delete-mesh.ts
|
|
@@ -4309,9 +4416,9 @@ var exports_delete_mesh = {};
|
|
|
4309
4416
|
__export(exports_delete_mesh, {
|
|
4310
4417
|
deleteMesh: () => deleteMesh
|
|
4311
4418
|
});
|
|
4312
|
-
import { createInterface as
|
|
4419
|
+
import { createInterface as createInterface4 } from "node:readline";
|
|
4313
4420
|
function prompt(question) {
|
|
4314
|
-
const rl =
|
|
4421
|
+
const rl = createInterface4({ input: process.stdin, output: process.stdout });
|
|
4315
4422
|
return new Promise((resolve) => {
|
|
4316
4423
|
rl.question(question, (a) => {
|
|
4317
4424
|
rl.close();
|
|
@@ -4363,7 +4470,7 @@ async function deleteMesh(slug, opts = {}) {
|
|
|
4363
4470
|
path: `/cli/mesh/${slug}`,
|
|
4364
4471
|
method: "DELETE",
|
|
4365
4472
|
body: { user_id: userId },
|
|
4366
|
-
baseUrl:
|
|
4473
|
+
baseUrl: BROKER_HTTP3
|
|
4367
4474
|
});
|
|
4368
4475
|
console.log(` ${green(icons.check)} Deleted "${slug}" from server.`);
|
|
4369
4476
|
}
|
|
@@ -4382,7 +4489,7 @@ async function deleteMesh(slug, opts = {}) {
|
|
|
4382
4489
|
console.log(` ${green(icons.check)} Removed "${slug}" from local config.`);
|
|
4383
4490
|
return EXIT.SUCCESS;
|
|
4384
4491
|
}
|
|
4385
|
-
var
|
|
4492
|
+
var BROKER_HTTP3;
|
|
4386
4493
|
var init_delete_mesh = __esm(() => {
|
|
4387
4494
|
init_facade();
|
|
4388
4495
|
init_facade9();
|
|
@@ -4391,7 +4498,7 @@ var init_delete_mesh = __esm(() => {
|
|
|
4391
4498
|
init_urls();
|
|
4392
4499
|
init_styles();
|
|
4393
4500
|
init_exit_codes();
|
|
4394
|
-
|
|
4501
|
+
BROKER_HTTP3 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
|
|
4395
4502
|
});
|
|
4396
4503
|
|
|
4397
4504
|
// src/commands/rename.ts
|
|
@@ -4454,9 +4561,9 @@ var exports_invite = {};
|
|
|
4454
4561
|
__export(exports_invite, {
|
|
4455
4562
|
invite: () => invite
|
|
4456
4563
|
});
|
|
4457
|
-
import { createInterface as
|
|
4564
|
+
import { createInterface as createInterface5 } from "node:readline";
|
|
4458
4565
|
function prompt2(question) {
|
|
4459
|
-
const rl =
|
|
4566
|
+
const rl = createInterface5({ input: process.stdin, output: process.stdout });
|
|
4460
4567
|
return new Promise((resolve) => {
|
|
4461
4568
|
rl.question(question, (a) => {
|
|
4462
4569
|
rl.close();
|
|
@@ -4571,9 +4678,9 @@ var exports_login = {};
|
|
|
4571
4678
|
__export(exports_login, {
|
|
4572
4679
|
login: () => login
|
|
4573
4680
|
});
|
|
4574
|
-
import { createInterface as
|
|
4681
|
+
import { createInterface as createInterface6 } from "node:readline";
|
|
4575
4682
|
function prompt3(question) {
|
|
4576
|
-
const rl =
|
|
4683
|
+
const rl = createInterface6({ input: process.stdin, output: process.stdout });
|
|
4577
4684
|
return new Promise((resolve) => {
|
|
4578
4685
|
rl.question(question, (answer) => {
|
|
4579
4686
|
rl.close();
|
|
@@ -4700,13 +4807,13 @@ __export(exports_welcome, {
|
|
|
4700
4807
|
runWelcome: () => runWelcome,
|
|
4701
4808
|
_stub: () => runWelcome
|
|
4702
4809
|
});
|
|
4703
|
-
import { createInterface as
|
|
4810
|
+
import { createInterface as createInterface7 } from "node:readline";
|
|
4704
4811
|
async function runWelcome() {
|
|
4705
4812
|
const config = readConfig();
|
|
4706
4813
|
if (config.meshes.length > 0)
|
|
4707
4814
|
return EXIT.SUCCESS;
|
|
4708
4815
|
renderWelcome();
|
|
4709
|
-
const rl =
|
|
4816
|
+
const rl = createInterface7({ input: process.stdin, output: process.stdout });
|
|
4710
4817
|
return new Promise((resolve) => {
|
|
4711
4818
|
rl.question(" Choice [1]: ", async (answer) => {
|
|
4712
4819
|
rl.close();
|
|
@@ -7857,7 +7964,7 @@ var init_whoami = __esm(() => {
|
|
|
7857
7964
|
|
|
7858
7965
|
// src/commands/connect.ts
|
|
7859
7966
|
import { hostname as hostname4 } from "node:os";
|
|
7860
|
-
import { createInterface as
|
|
7967
|
+
import { createInterface as createInterface8 } from "node:readline";
|
|
7861
7968
|
async function pickMesh2(meshes) {
|
|
7862
7969
|
console.log(`
|
|
7863
7970
|
Select mesh:`);
|
|
@@ -7865,7 +7972,7 @@ async function pickMesh2(meshes) {
|
|
|
7865
7972
|
console.log(` ${i + 1}) ${m.slug}`);
|
|
7866
7973
|
});
|
|
7867
7974
|
console.log("");
|
|
7868
|
-
const rl =
|
|
7975
|
+
const rl = createInterface8({ input: process.stdin, output: process.stdout });
|
|
7869
7976
|
return new Promise((resolve) => {
|
|
7870
7977
|
rl.question(" Choice [1]: ", (answer) => {
|
|
7871
7978
|
rl.close();
|
|
@@ -8487,7 +8594,7 @@ async function runStatus() {
|
|
|
8487
8594
|
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
8488
8595
|
const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
|
|
8489
8596
|
const green3 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
|
|
8490
|
-
const
|
|
8597
|
+
const red3 = (s) => useColor ? `\x1B[31m${s}\x1B[39m` : s;
|
|
8491
8598
|
console.log(`claudemesh status (v${VERSION})`);
|
|
8492
8599
|
console.log("─".repeat(60));
|
|
8493
8600
|
const configPath = getConfigPath();
|
|
@@ -8520,7 +8627,7 @@ async function runStatus() {
|
|
|
8520
8627
|
if (probe.ok) {
|
|
8521
8628
|
console.log(green3("reachable"));
|
|
8522
8629
|
} else {
|
|
8523
|
-
console.log(
|
|
8630
|
+
console.log(red3(`unreachable (${probe.error})`));
|
|
8524
8631
|
}
|
|
8525
8632
|
}
|
|
8526
8633
|
console.log("");
|
|
@@ -8534,7 +8641,7 @@ async function runStatus() {
|
|
|
8534
8641
|
process.exit(0);
|
|
8535
8642
|
} else {
|
|
8536
8643
|
const broken = results.filter((r) => !r.reachable).length;
|
|
8537
|
-
console.log(
|
|
8644
|
+
console.log(red3(`${broken} of ${results.length} mesh(es) unreachable.`));
|
|
8538
8645
|
process.exit(1);
|
|
8539
8646
|
}
|
|
8540
8647
|
}
|
|
@@ -8698,7 +8805,7 @@ async function runDoctor() {
|
|
|
8698
8805
|
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
8699
8806
|
const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
|
|
8700
8807
|
const green3 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
|
|
8701
|
-
const
|
|
8808
|
+
const red3 = (s) => useColor ? `\x1B[31m${s}\x1B[39m` : s;
|
|
8702
8809
|
console.log(`claudemesh doctor (v${VERSION})`);
|
|
8703
8810
|
console.log("─".repeat(60));
|
|
8704
8811
|
const checks = [
|
|
@@ -8710,7 +8817,7 @@ async function runDoctor() {
|
|
|
8710
8817
|
checkKeypairs()
|
|
8711
8818
|
];
|
|
8712
8819
|
for (const c of checks) {
|
|
8713
|
-
const mark = c.pass ? green3("✓") :
|
|
8820
|
+
const mark = c.pass ? green3("✓") : red3("✗");
|
|
8714
8821
|
const detail = c.detail ? dim2(` (${c.detail})`) : "";
|
|
8715
8822
|
console.log(`${mark} ${c.name}${detail}`);
|
|
8716
8823
|
if (!c.pass && c.fix) {
|
|
@@ -8723,7 +8830,7 @@ async function runDoctor() {
|
|
|
8723
8830
|
console.log(green3("All checks passed."));
|
|
8724
8831
|
process.exit(0);
|
|
8725
8832
|
} else {
|
|
8726
|
-
console.log(
|
|
8833
|
+
console.log(red3(`${failing.length} check(s) failed.`));
|
|
8727
8834
|
process.exit(1);
|
|
8728
8835
|
}
|
|
8729
8836
|
}
|
|
@@ -9160,7 +9267,7 @@ var exports_sync = {};
|
|
|
9160
9267
|
__export(exports_sync, {
|
|
9161
9268
|
runSync: () => runSync
|
|
9162
9269
|
});
|
|
9163
|
-
import { createInterface as
|
|
9270
|
+
import { createInterface as createInterface9 } from "node:readline";
|
|
9164
9271
|
import { hostname as hostname5 } from "node:os";
|
|
9165
9272
|
async function runSync(args) {
|
|
9166
9273
|
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
@@ -9174,7 +9281,7 @@ async function runSync(args) {
|
|
|
9174
9281
|
console.log(dim2(`Visit: ${url}`));
|
|
9175
9282
|
await openBrowser(url);
|
|
9176
9283
|
const manualPromise = new Promise((resolve2) => {
|
|
9177
|
-
const rl =
|
|
9284
|
+
const rl = createInterface9({ input: process.stdin, output: process.stdout });
|
|
9178
9285
|
rl.question("Paste sync token (or wait for browser): ", (answer) => {
|
|
9179
9286
|
rl.close();
|
|
9180
9287
|
if (answer.trim())
|
|
@@ -9563,7 +9670,7 @@ async function handleMeshSubcommand() {
|
|
|
9563
9670
|
case "list":
|
|
9564
9671
|
case "ls": {
|
|
9565
9672
|
const { runList: runList2 } = await Promise.resolve().then(() => (init_list2(), exports_list));
|
|
9566
|
-
runList2();
|
|
9673
|
+
await runList2();
|
|
9567
9674
|
break;
|
|
9568
9675
|
}
|
|
9569
9676
|
case "delete":
|
|
@@ -9769,4 +9876,4 @@ main().catch((err) => {
|
|
|
9769
9876
|
process.exit(EXIT.INTERNAL_ERROR);
|
|
9770
9877
|
});
|
|
9771
9878
|
|
|
9772
|
-
//# debugId=
|
|
9879
|
+
//# debugId=E76259A581E1545264756E2164756E21
|