claudemesh-cli 0.10.0 → 0.10.2

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.
Files changed (2) hide show
  1. package/dist/index.js +103 -62
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -40189,7 +40189,7 @@ var package_default;
40189
40189
  var init_package = __esm(() => {
40190
40190
  package_default = {
40191
40191
  name: "claudemesh-cli",
40192
- version: "0.10.0",
40192
+ version: "0.10.2",
40193
40193
  description: "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
40194
40194
  keywords: [
40195
40195
  "claude-code",
@@ -54909,9 +54909,74 @@ async function runDoctor() {
54909
54909
  // src/commands/welcome.ts
54910
54910
  init_config();
54911
54911
  import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs";
54912
- import { homedir as homedir6, hostname as hostname3 } from "node:os";
54912
+ import { homedir as homedir6, hostname as hostname4 } from "node:os";
54913
54913
  import { join as join6 } from "node:path";
54914
54914
  import { createInterface as createInterface2 } from "node:readline";
54915
+
54916
+ // src/commands/peers.ts
54917
+ init_config();
54918
+ import { hostname as hostname3 } from "node:os";
54919
+ async function runPeers(flags) {
54920
+ const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
54921
+ const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
54922
+ const bold3 = (s) => useColor ? `\x1B[1m${s}\x1B[22m` : s;
54923
+ const green2 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
54924
+ const yellow2 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
54925
+ const config2 = loadConfig();
54926
+ const meshes = flags.mesh ? config2.meshes.filter((m) => m.slug === flags.mesh) : config2.meshes;
54927
+ if (meshes.length === 0) {
54928
+ console.error(flags.mesh ? `Mesh "${flags.mesh}" not found. Joined: ${config2.meshes.map((m) => m.slug).join(", ")}` : "No meshes joined. Run `claudemesh join <url>` first.");
54929
+ process.exit(1);
54930
+ }
54931
+ const allPeers = [];
54932
+ for (const mesh of meshes) {
54933
+ const displayName = config2.displayName ?? `${hostname3()}-${process.pid}`;
54934
+ const client2 = new BrokerClient(mesh, { displayName });
54935
+ try {
54936
+ await client2.connect();
54937
+ const peers = await client2.listPeers();
54938
+ if (flags.json) {
54939
+ allPeers.push({ mesh: mesh.slug, peers });
54940
+ continue;
54941
+ }
54942
+ console.log(bold3(`Peers on ${mesh.slug}`) + dim2(` (${peers.length})`));
54943
+ console.log("");
54944
+ if (peers.length === 0) {
54945
+ console.log(dim2(" No peers connected."));
54946
+ } else {
54947
+ for (const p of peers) {
54948
+ const groups = p.groups.length ? " [" + p.groups.map((g) => `@${g.name}${g.role ? `:${g.role}` : ""}`).join(", ") + "]" : "";
54949
+ const statusIcon = p.status === "working" ? yellow2("●") : green2("●");
54950
+ const name = bold3(p.displayName);
54951
+ const meta2 = [];
54952
+ if (p.peerType)
54953
+ meta2.push(p.peerType);
54954
+ if (p.channel)
54955
+ meta2.push(p.channel);
54956
+ if (p.model)
54957
+ meta2.push(p.model);
54958
+ const metaStr = meta2.length ? dim2(` (${meta2.join(", ")})`) : "";
54959
+ const cwdStr = p.cwd ? dim2(` cwd: ${p.cwd}`) : "";
54960
+ const summary = p.summary ? dim2(` ${p.summary}`) : "";
54961
+ console.log(` ${statusIcon} ${name}${groups}${metaStr}${summary}`);
54962
+ if (cwdStr)
54963
+ console.log(` ${cwdStr}`);
54964
+ }
54965
+ }
54966
+ console.log("");
54967
+ } catch (e) {
54968
+ console.error(dim2(` Could not connect to ${mesh.slug}: ${e instanceof Error ? e.message : String(e)}`));
54969
+ console.log("");
54970
+ } finally {
54971
+ client2.close();
54972
+ }
54973
+ }
54974
+ if (flags.json) {
54975
+ console.log(JSON.stringify(meshes.length === 1 ? allPeers[0]?.peers : allPeers, null, 2));
54976
+ }
54977
+ }
54978
+
54979
+ // src/commands/welcome.ts
54915
54980
  init_colors();
54916
54981
  init_spinner();
54917
54982
  function detectState() {
@@ -55045,7 +55110,7 @@ async function runWelcome() {
55045
55110
  }
55046
55111
  const { generateKeypair: generateKeypair3 } = await Promise.resolve().then(() => (init_keypair(), exports_keypair));
55047
55112
  const keypair = await generateKeypair3();
55048
- const displayName = `${hostname3()}-${process.pid}`;
55113
+ const displayName = `${hostname4()}-${process.pid}`;
55049
55114
  const { syncWithBroker: syncWithBroker2 } = await Promise.resolve().then(() => exports_sync_with_broker);
55050
55115
  const result = await syncWithBroker2(syncToken, keypair.publicKey, displayName);
55051
55116
  const config2 = loadConfig();
@@ -55110,17 +55175,14 @@ async function runWelcome() {
55110
55175
  await runLaunch({}, []);
55111
55176
  return;
55112
55177
  case 1:
55113
- console.log(green("$") + ` claudemesh peers
55114
- `);
55115
- break;
55178
+ await runPeers({});
55179
+ return;
55116
55180
  case 2:
55117
- console.log(green("$") + ` claudemesh status
55118
- `);
55119
- break;
55181
+ await runStatus();
55182
+ return;
55120
55183
  case 3:
55121
- console.log(green("$") + ` claudemesh doctor
55122
- `);
55123
- break;
55184
+ await runDoctor();
55185
+ return;
55124
55186
  }
55125
55187
  return;
55126
55188
  }
@@ -55165,8 +55227,30 @@ function runWelcomePlain() {
55165
55227
  }
55166
55228
 
55167
55229
  // src/commands/connect.ts
55168
- import { hostname as hostname4 } from "node:os";
55230
+ import { hostname as hostname5 } from "node:os";
55231
+ import { createInterface as createInterface3 } from "node:readline";
55169
55232
  init_config();
55233
+ async function pickMesh2(meshes) {
55234
+ console.log(`
55235
+ Select mesh:`);
55236
+ meshes.forEach((m, i) => {
55237
+ console.log(` ${i + 1}) ${m.slug}`);
55238
+ });
55239
+ console.log("");
55240
+ const rl = createInterface3({ input: process.stdin, output: process.stdout });
55241
+ return new Promise((resolve2) => {
55242
+ rl.question(" Choice [1]: ", (answer) => {
55243
+ rl.close();
55244
+ const idx = parseInt(answer || "1", 10) - 1;
55245
+ if (idx >= 0 && idx < meshes.length) {
55246
+ resolve2(meshes[idx]);
55247
+ } else {
55248
+ console.error(" Invalid choice, using first mesh.");
55249
+ resolve2(meshes[0]);
55250
+ }
55251
+ });
55252
+ });
55253
+ }
55170
55254
  async function withMesh(opts, fn) {
55171
55255
  const config2 = loadConfig();
55172
55256
  if (config2.meshes.length === 0) {
@@ -55184,11 +55268,9 @@ async function withMesh(opts, fn) {
55184
55268
  } else if (config2.meshes.length === 1) {
55185
55269
  mesh = config2.meshes[0];
55186
55270
  } else {
55187
- console.error(`Multiple meshes joined. Specify one with --mesh <slug>.
55188
- Joined: ${config2.meshes.map((m) => m.slug).join(", ")}`);
55189
- process.exit(1);
55271
+ mesh = await pickMesh2(config2.meshes);
55190
55272
  }
55191
- const displayName = opts.displayName ?? config2.displayName ?? `${hostname4()}-${process.pid}`;
55273
+ const displayName = opts.displayName ?? config2.displayName ?? `${hostname5()}-${process.pid}`;
55192
55274
  const client2 = new BrokerClient(mesh, { displayName });
55193
55275
  try {
55194
55276
  await client2.connect();
@@ -55199,47 +55281,6 @@ Joined: ${config2.meshes.map((m) => m.slug).join(", ")}`);
55199
55281
  }
55200
55282
  }
55201
55283
 
55202
- // src/commands/peers.ts
55203
- async function runPeers(flags) {
55204
- const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
55205
- const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
55206
- const bold3 = (s) => useColor ? `\x1B[1m${s}\x1B[22m` : s;
55207
- const green2 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
55208
- const yellow2 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
55209
- await withMesh({ meshSlug: flags.mesh ?? null }, async (client2, mesh) => {
55210
- const peers = await client2.listPeers();
55211
- if (flags.json) {
55212
- console.log(JSON.stringify(peers, null, 2));
55213
- return;
55214
- }
55215
- if (peers.length === 0) {
55216
- console.log(dim2(`No peers connected on mesh "${mesh.slug}".`));
55217
- return;
55218
- }
55219
- console.log(bold3(`Peers on ${mesh.slug}`) + dim2(` (${peers.length})`));
55220
- console.log("");
55221
- for (const p of peers) {
55222
- const groups = p.groups.length ? " [" + p.groups.map((g) => `@${g.name}${g.role ? `:${g.role}` : ""}`).join(", ") + "]" : "";
55223
- const statusIcon = p.status === "working" ? yellow2("●") : green2("●");
55224
- const name = bold3(p.displayName);
55225
- const meta2 = [];
55226
- if (p.peerType)
55227
- meta2.push(p.peerType);
55228
- if (p.channel)
55229
- meta2.push(p.channel);
55230
- if (p.model)
55231
- meta2.push(p.model);
55232
- const metaStr = meta2.length ? dim2(` (${meta2.join(", ")})`) : "";
55233
- const cwdStr = p.cwd ? dim2(` cwd: ${p.cwd}`) : "";
55234
- const summary = p.summary ? dim2(` ${p.summary}`) : "";
55235
- console.log(` ${statusIcon} ${name}${groups}${metaStr}${summary}`);
55236
- if (cwdStr)
55237
- console.log(` ${cwdStr}`);
55238
- }
55239
- console.log("");
55240
- });
55241
- }
55242
-
55243
55284
  // src/commands/send.ts
55244
55285
  async function runSend(flags, to, message) {
55245
55286
  const priority = flags.priority === "now" ? "now" : flags.priority === "low" ? "low" : "next";
@@ -55704,8 +55745,8 @@ function runCreate(args) {
55704
55745
  init_config();
55705
55746
  init_auth();
55706
55747
  init_keypair();
55707
- import { createInterface as createInterface3 } from "node:readline";
55708
- import { hostname as hostname5 } from "node:os";
55748
+ import { createInterface as createInterface4 } from "node:readline";
55749
+ import { hostname as hostname6 } from "node:os";
55709
55750
  async function runSync(args) {
55710
55751
  const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
55711
55752
  const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
@@ -55718,7 +55759,7 @@ async function runSync(args) {
55718
55759
  console.log(dim2(`Visit: ${url}`));
55719
55760
  await openBrowser(url);
55720
55761
  const manualPromise = new Promise((resolve2) => {
55721
- const rl = createInterface3({ input: process.stdin, output: process.stdout });
55762
+ const rl = createInterface4({ input: process.stdin, output: process.stdout });
55722
55763
  rl.question("Paste sync token (or wait for browser): ", (answer) => {
55723
55764
  rl.close();
55724
55765
  if (answer.trim())
@@ -55739,7 +55780,7 @@ async function runSync(args) {
55739
55780
  process.exit(1);
55740
55781
  }
55741
55782
  const keypair = config2.meshes.length > 0 ? { publicKey: config2.meshes[0].pubkey, secretKey: config2.meshes[0].secretKey } : await generateKeypair2();
55742
- const displayName = config2.displayName ?? `${hostname5()}-${process.pid}`;
55783
+ const displayName = config2.displayName ?? `${hostname6()}-${process.pid}`;
55743
55784
  const result = await syncWithBroker(syncToken, keypair.publicKey, displayName);
55744
55785
  let added = 0;
55745
55786
  for (const m of result.meshes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudemesh-cli",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -48,10 +48,10 @@
48
48
  "prettier": "3.6.2",
49
49
  "typescript": "5.9.3",
50
50
  "vitest": "4.0.14",
51
- "@turbostarter/prettier-config": "0.1.0",
52
- "@turbostarter/vitest-config": "0.1.0",
53
51
  "@turbostarter/tsconfig": "0.1.0",
54
- "@turbostarter/eslint-config": "0.1.0"
52
+ "@turbostarter/vitest-config": "0.1.0",
53
+ "@turbostarter/eslint-config": "0.1.0",
54
+ "@turbostarter/prettier-config": "0.1.0"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "bun build src/index.ts --target=node --outfile dist/index.js --banner \"#!/usr/bin/env node\" && chmod +x dist/index.js",