claudemesh-cli 1.0.0-alpha.13 → 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 +81 -27
- package/dist/entrypoints/cli.js.map +4 -4
- package/package.json +3 -3
package/dist/entrypoints/cli.js
CHANGED
|
@@ -4331,30 +4331,84 @@ var exports_list = {};
|
|
|
4331
4331
|
__export(exports_list, {
|
|
4332
4332
|
runList: () => runList
|
|
4333
4333
|
});
|
|
4334
|
-
function runList() {
|
|
4334
|
+
async function runList() {
|
|
4335
4335
|
const config = readConfig();
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
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
|
+
`);
|
|
4341
4364
|
return;
|
|
4342
4365
|
}
|
|
4343
|
-
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
|
+
}
|
|
4344
4397
|
console.log("");
|
|
4345
|
-
|
|
4346
|
-
console.log(`
|
|
4347
|
-
console.log(` mesh id: ${m.meshId}`);
|
|
4348
|
-
console.log(` member id: ${m.memberId}`);
|
|
4349
|
-
console.log(` pubkey: ${m.pubkey.slice(0, 16)}…`);
|
|
4350
|
-
console.log(` broker: ${m.brokerUrl}`);
|
|
4351
|
-
console.log(` joined: ${m.joinedAt}`);
|
|
4352
|
-
console.log("");
|
|
4398
|
+
if (serverMeshes.some((m) => !localSlugs.has(m.slug))) {
|
|
4399
|
+
console.log(dim(" ○ = server only — run `claudemesh mesh add` to use locally"));
|
|
4353
4400
|
}
|
|
4354
|
-
console.log(`Config: ${getConfigPath()}`);
|
|
4401
|
+
console.log(dim(` Config: ${getConfigPath()}`));
|
|
4402
|
+
console.log("");
|
|
4355
4403
|
}
|
|
4404
|
+
var BROKER_HTTP2;
|
|
4356
4405
|
var init_list2 = __esm(() => {
|
|
4357
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", "");
|
|
4358
4412
|
});
|
|
4359
4413
|
|
|
4360
4414
|
// src/commands/delete-mesh.ts
|
|
@@ -4416,7 +4470,7 @@ async function deleteMesh(slug, opts = {}) {
|
|
|
4416
4470
|
path: `/cli/mesh/${slug}`,
|
|
4417
4471
|
method: "DELETE",
|
|
4418
4472
|
body: { user_id: userId },
|
|
4419
|
-
baseUrl:
|
|
4473
|
+
baseUrl: BROKER_HTTP3
|
|
4420
4474
|
});
|
|
4421
4475
|
console.log(` ${green(icons.check)} Deleted "${slug}" from server.`);
|
|
4422
4476
|
}
|
|
@@ -4435,7 +4489,7 @@ async function deleteMesh(slug, opts = {}) {
|
|
|
4435
4489
|
console.log(` ${green(icons.check)} Removed "${slug}" from local config.`);
|
|
4436
4490
|
return EXIT.SUCCESS;
|
|
4437
4491
|
}
|
|
4438
|
-
var
|
|
4492
|
+
var BROKER_HTTP3;
|
|
4439
4493
|
var init_delete_mesh = __esm(() => {
|
|
4440
4494
|
init_facade();
|
|
4441
4495
|
init_facade9();
|
|
@@ -4444,7 +4498,7 @@ var init_delete_mesh = __esm(() => {
|
|
|
4444
4498
|
init_urls();
|
|
4445
4499
|
init_styles();
|
|
4446
4500
|
init_exit_codes();
|
|
4447
|
-
|
|
4501
|
+
BROKER_HTTP3 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
|
|
4448
4502
|
});
|
|
4449
4503
|
|
|
4450
4504
|
// src/commands/rename.ts
|
|
@@ -8540,7 +8594,7 @@ async function runStatus() {
|
|
|
8540
8594
|
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
8541
8595
|
const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
|
|
8542
8596
|
const green3 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
|
|
8543
|
-
const
|
|
8597
|
+
const red3 = (s) => useColor ? `\x1B[31m${s}\x1B[39m` : s;
|
|
8544
8598
|
console.log(`claudemesh status (v${VERSION})`);
|
|
8545
8599
|
console.log("─".repeat(60));
|
|
8546
8600
|
const configPath = getConfigPath();
|
|
@@ -8573,7 +8627,7 @@ async function runStatus() {
|
|
|
8573
8627
|
if (probe.ok) {
|
|
8574
8628
|
console.log(green3("reachable"));
|
|
8575
8629
|
} else {
|
|
8576
|
-
console.log(
|
|
8630
|
+
console.log(red3(`unreachable (${probe.error})`));
|
|
8577
8631
|
}
|
|
8578
8632
|
}
|
|
8579
8633
|
console.log("");
|
|
@@ -8587,7 +8641,7 @@ async function runStatus() {
|
|
|
8587
8641
|
process.exit(0);
|
|
8588
8642
|
} else {
|
|
8589
8643
|
const broken = results.filter((r) => !r.reachable).length;
|
|
8590
|
-
console.log(
|
|
8644
|
+
console.log(red3(`${broken} of ${results.length} mesh(es) unreachable.`));
|
|
8591
8645
|
process.exit(1);
|
|
8592
8646
|
}
|
|
8593
8647
|
}
|
|
@@ -8751,7 +8805,7 @@ async function runDoctor() {
|
|
|
8751
8805
|
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
8752
8806
|
const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
|
|
8753
8807
|
const green3 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
|
|
8754
|
-
const
|
|
8808
|
+
const red3 = (s) => useColor ? `\x1B[31m${s}\x1B[39m` : s;
|
|
8755
8809
|
console.log(`claudemesh doctor (v${VERSION})`);
|
|
8756
8810
|
console.log("─".repeat(60));
|
|
8757
8811
|
const checks = [
|
|
@@ -8763,7 +8817,7 @@ async function runDoctor() {
|
|
|
8763
8817
|
checkKeypairs()
|
|
8764
8818
|
];
|
|
8765
8819
|
for (const c of checks) {
|
|
8766
|
-
const mark = c.pass ? green3("✓") :
|
|
8820
|
+
const mark = c.pass ? green3("✓") : red3("✗");
|
|
8767
8821
|
const detail = c.detail ? dim2(` (${c.detail})`) : "";
|
|
8768
8822
|
console.log(`${mark} ${c.name}${detail}`);
|
|
8769
8823
|
if (!c.pass && c.fix) {
|
|
@@ -8776,7 +8830,7 @@ async function runDoctor() {
|
|
|
8776
8830
|
console.log(green3("All checks passed."));
|
|
8777
8831
|
process.exit(0);
|
|
8778
8832
|
} else {
|
|
8779
|
-
console.log(
|
|
8833
|
+
console.log(red3(`${failing.length} check(s) failed.`));
|
|
8780
8834
|
process.exit(1);
|
|
8781
8835
|
}
|
|
8782
8836
|
}
|
|
@@ -9616,7 +9670,7 @@ async function handleMeshSubcommand() {
|
|
|
9616
9670
|
case "list":
|
|
9617
9671
|
case "ls": {
|
|
9618
9672
|
const { runList: runList2 } = await Promise.resolve().then(() => (init_list2(), exports_list));
|
|
9619
|
-
runList2();
|
|
9673
|
+
await runList2();
|
|
9620
9674
|
break;
|
|
9621
9675
|
}
|
|
9622
9676
|
case "delete":
|
|
@@ -9822,4 +9876,4 @@ main().catch((err) => {
|
|
|
9822
9876
|
process.exit(EXIT.INTERNAL_ERROR);
|
|
9823
9877
|
});
|
|
9824
9878
|
|
|
9825
|
-
//# debugId=
|
|
9879
|
+
//# debugId=E76259A581E1545264756E2164756E21
|