claudemesh-cli 1.0.0-alpha.30 → 1.0.0-alpha.31

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.
@@ -88,7 +88,7 @@ __export(exports_urls, {
88
88
  VERSION: () => VERSION,
89
89
  URLS: () => URLS
90
90
  });
91
- var URLS, VERSION = "1.0.0-alpha.27", env;
91
+ var URLS, VERSION = "1.0.0-alpha.31", env;
92
92
  var init_urls = __esm(() => {
93
93
  URLS = {
94
94
  BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
@@ -6141,15 +6141,11 @@ __export(exports_peers, {
6141
6141
  runPeers: () => runPeers
6142
6142
  });
6143
6143
  async function runPeers(flags) {
6144
- const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
6145
- const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
6146
- const bold2 = (s) => useColor ? `\x1B[1m${s}\x1B[22m` : s;
6147
- const green3 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
6148
- const yellow2 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
6149
6144
  const config = readConfig();
6150
6145
  const slugs = flags.mesh ? [flags.mesh] : config.meshes.map((m) => m.slug);
6151
6146
  if (slugs.length === 0) {
6152
- console.error("No meshes joined. Run `claudemesh join <url>` first.");
6147
+ render.err("No meshes joined.");
6148
+ render.hint("claudemesh <invite-url> # join + launch");
6153
6149
  process.exit(1);
6154
6150
  }
6155
6151
  const allJson = [];
@@ -6161,44 +6157,43 @@ async function runPeers(flags) {
6161
6157
  allJson.push({ mesh: mesh.slug, peers });
6162
6158
  return;
6163
6159
  }
6164
- console.log(bold2(`Peers on ${mesh.slug}`) + dim2(` (${peers.length})`));
6165
- console.log("");
6160
+ render.section(`peers on ${mesh.slug} (${peers.length})`);
6166
6161
  if (peers.length === 0) {
6167
- console.log(dim2(" No peers connected."));
6168
- } else {
6169
- for (const p of peers) {
6170
- const groups = p.groups.length ? " [" + p.groups.map((g) => `@${g.name}${g.role ? `:${g.role}` : ""}`).join(", ") + "]" : "";
6171
- const statusIcon = p.status === "working" ? yellow2("") : green3("");
6172
- const name = bold2(p.displayName);
6173
- const meta = [];
6174
- if (p.peerType)
6175
- meta.push(p.peerType);
6176
- if (p.channel)
6177
- meta.push(p.channel);
6178
- if (p.model)
6179
- meta.push(p.model);
6180
- const metaStr = meta.length ? dim2(` (${meta.join(", ")})`) : "";
6181
- const cwdStr = p.cwd ? dim2(` cwd: ${p.cwd}`) : "";
6182
- const summary = p.summary ? dim2(` ${p.summary}`) : "";
6183
- console.log(` ${statusIcon} ${name}${groups}${metaStr}${summary}`);
6184
- if (cwdStr)
6185
- console.log(` ${cwdStr}`);
6186
- }
6162
+ render.info(dim(" (no peers connected)"));
6163
+ return;
6164
+ }
6165
+ for (const p of peers) {
6166
+ const groups = p.groups.length ? " [" + p.groups.map((g) => `@${g.name}${g.role ? `:${g.role}` : ""}`).join(", ") + "]" : "";
6167
+ const statusDot = p.status === "working" ? yellow("●") : green("●");
6168
+ const name = bold(p.displayName);
6169
+ const meta = [];
6170
+ if (p.peerType)
6171
+ meta.push(p.peerType);
6172
+ if (p.channel)
6173
+ meta.push(p.channel);
6174
+ if (p.model)
6175
+ meta.push(p.model);
6176
+ const metaStr = meta.length ? dim(` (${meta.join(", ")})`) : "";
6177
+ const summary = p.summary ? dim(` ${p.summary}`) : "";
6178
+ render.info(`${statusDot} ${name}${groups}${metaStr}${summary}`);
6179
+ if (p.cwd)
6180
+ render.info(dim(` cwd: ${p.cwd}`));
6187
6181
  }
6188
- console.log("");
6189
6182
  });
6190
6183
  } catch (e) {
6191
- console.error(dim2(` Could not connect to ${slug}: ${e instanceof Error ? e.message : String(e)}`));
6192
- console.log("");
6184
+ render.err(`${slug}: ${e instanceof Error ? e.message : String(e)}`);
6193
6185
  }
6194
6186
  }
6195
6187
  if (flags.json) {
6196
- console.log(JSON.stringify(slugs.length === 1 ? allJson[0]?.peers : allJson, null, 2));
6188
+ process.stdout.write(JSON.stringify(slugs.length === 1 ? allJson[0]?.peers : allJson, null, 2) + `
6189
+ `);
6197
6190
  }
6198
6191
  }
6199
6192
  var init_peers = __esm(() => {
6200
6193
  init_connect();
6201
6194
  init_facade();
6195
+ init_render();
6196
+ init_styles();
6202
6197
  });
6203
6198
 
6204
6199
  // src/commands/send.ts
@@ -7467,6 +7462,7 @@ import { statSync as statSync3, existsSync as existsSync8 } from "node:fs";
7467
7462
  import WebSocket2 from "ws";
7468
7463
  async function probeBroker(url, timeoutMs = 4000) {
7469
7464
  return new Promise((resolve2) => {
7465
+ const started = Date.now();
7470
7466
  const ws = new WebSocket2(url);
7471
7467
  const timer = setTimeout(() => {
7472
7468
  try {
@@ -7476,10 +7472,11 @@ async function probeBroker(url, timeoutMs = 4000) {
7476
7472
  }, timeoutMs);
7477
7473
  ws.on("open", () => {
7478
7474
  clearTimeout(timer);
7475
+ const latency = Date.now() - started;
7479
7476
  try {
7480
7477
  ws.close();
7481
7478
  } catch {}
7482
- resolve2({ ok: true });
7479
+ resolve2({ ok: true, latencyMs: latency });
7483
7480
  });
7484
7481
  ws.on("error", (err) => {
7485
7482
  clearTimeout(timer);
@@ -7488,63 +7485,60 @@ async function probeBroker(url, timeoutMs = 4000) {
7488
7485
  });
7489
7486
  }
7490
7487
  async function runStatus() {
7491
- const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
7492
- const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
7493
- const green3 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
7494
- const red3 = (s) => useColor ? `\x1B[31m${s}\x1B[39m` : s;
7495
- console.log(`claudemesh status (v${VERSION})`);
7496
- console.log("─".repeat(60));
7488
+ render.section(`status (v${VERSION})`);
7497
7489
  const configPath = getConfigPath();
7498
- let configPerms = "missing";
7490
+ let configPermsNote = "missing";
7499
7491
  if (existsSync8(configPath)) {
7500
- const st = statSync3(configPath);
7501
- const mode = (st.mode & 511).toString(8).padStart(4, "0");
7502
- configPerms = mode === "0600" ? `${mode} ✓` : `${mode} ⚠ (expected 0600)`;
7492
+ const mode = (statSync3(configPath).mode & 511).toString(8).padStart(4, "0");
7493
+ configPermsNote = mode === "0600" ? `${mode}` : `${mode} — expected 0600`;
7503
7494
  }
7504
- console.log(`Config: ${configPath} (${configPerms})`);
7495
+ render.kv([["config", configPath], ["perms", configPermsNote]]);
7505
7496
  const config = readConfig();
7506
7497
  if (config.meshes.length === 0) {
7507
- console.log("");
7508
- console.log(dim2("No meshes joined. Run `claudemesh join <invite-url>` to get started."));
7498
+ render.blank();
7499
+ render.info("No meshes joined.");
7500
+ render.hint("claudemesh <invite-url> # join + launch");
7509
7501
  process.exit(0);
7510
7502
  }
7511
- console.log("");
7512
- console.log(`Meshes (${config.meshes.length}):`);
7503
+ render.blank();
7504
+ render.heading(`meshes (${config.meshes.length})`);
7513
7505
  const results = [];
7514
7506
  for (const m of config.meshes) {
7515
- process.stdout.write(` ${m.slug.padEnd(20)} probing ${m.brokerUrl}… `);
7516
7507
  const probe = await probeBroker(m.brokerUrl);
7517
- results.push({
7508
+ const entry = {
7518
7509
  slug: m.slug,
7519
7510
  brokerUrl: m.brokerUrl,
7520
7511
  pubkey: m.pubkey,
7521
7512
  reachable: probe.ok,
7522
- error: probe.error
7523
- });
7513
+ error: probe.error,
7514
+ latencyMs: probe.latencyMs
7515
+ };
7516
+ results.push(entry);
7524
7517
  if (probe.ok) {
7525
- console.log(green3("reachable"));
7518
+ render.ok(`${m.slug}`, `${probe.latencyMs}ms → ${m.brokerUrl}`);
7526
7519
  } else {
7527
- console.log(red3(`unreachable (${probe.error})`));
7520
+ render.err(`${m.slug}`, `unreachable (${probe.error})`);
7528
7521
  }
7529
7522
  }
7530
- console.log("");
7523
+ render.blank();
7531
7524
  for (const r of results) {
7532
- console.log(dim2(` ${r.slug}: pubkey ${r.pubkey.slice(0, 16)}…`));
7525
+ render.kv([[r.slug, `${r.pubkey.slice(0, 16)}…`]]);
7533
7526
  }
7534
7527
  const allOk = results.every((r) => r.reachable);
7535
- console.log("");
7528
+ render.blank();
7536
7529
  if (allOk) {
7537
- console.log(green3("All meshes reachable."));
7530
+ render.ok("all meshes reachable");
7538
7531
  process.exit(0);
7539
7532
  } else {
7540
7533
  const broken = results.filter((r) => !r.reachable).length;
7541
- console.log(red3(`${broken} of ${results.length} mesh(es) unreachable.`));
7534
+ render.err(`${broken} of ${results.length} mesh(es) unreachable`);
7542
7535
  process.exit(1);
7543
7536
  }
7544
7537
  }
7545
7538
  var init_status = __esm(() => {
7546
7539
  init_facade();
7547
7540
  init_urls();
7541
+ init_render();
7548
7542
  });
7549
7543
 
7550
7544
  // src/commands/sync.ts
@@ -12452,4 +12446,4 @@ main().catch((err) => {
12452
12446
  process.exit(EXIT.INTERNAL_ERROR);
12453
12447
  });
12454
12448
 
12455
- //# debugId=AF03F88BC783BD6C64756E2164756E21
12449
+ //# debugId=A6858740B3A6F9A864756E2164756E21