claudemesh-cli 0.10.2 → 0.10.3

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 +98 -102
  2. package/package.json +3 -3
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.2",
40192
+ version: "0.10.3",
40193
40193
  description: "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
40194
40194
  keywords: [
40195
40195
  "claude-code",
@@ -54911,11 +54911,65 @@ init_config();
54911
54911
  import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs";
54912
54912
  import { homedir as homedir6, hostname as hostname4 } from "node:os";
54913
54913
  import { join as join6 } from "node:path";
54914
+ import { createInterface as createInterface3 } from "node:readline";
54915
+
54916
+ // src/commands/connect.ts
54917
+ import { hostname as hostname3 } from "node:os";
54914
54918
  import { createInterface as createInterface2 } from "node:readline";
54919
+ init_config();
54920
+ async function pickMesh2(meshes) {
54921
+ console.log(`
54922
+ Select mesh:`);
54923
+ meshes.forEach((m, i) => {
54924
+ console.log(` ${i + 1}) ${m.slug}`);
54925
+ });
54926
+ console.log("");
54927
+ const rl = createInterface2({ input: process.stdin, output: process.stdout });
54928
+ return new Promise((resolve2) => {
54929
+ rl.question(" Choice [1]: ", (answer) => {
54930
+ rl.close();
54931
+ const idx = parseInt(answer || "1", 10) - 1;
54932
+ if (idx >= 0 && idx < meshes.length) {
54933
+ resolve2(meshes[idx]);
54934
+ } else {
54935
+ console.error(" Invalid choice, using first mesh.");
54936
+ resolve2(meshes[0]);
54937
+ }
54938
+ });
54939
+ });
54940
+ }
54941
+ async function withMesh(opts, fn) {
54942
+ const config2 = loadConfig();
54943
+ if (config2.meshes.length === 0) {
54944
+ console.error("No meshes joined. Run `claudemesh join <url>` first.");
54945
+ process.exit(1);
54946
+ }
54947
+ let mesh;
54948
+ if (opts.meshSlug) {
54949
+ const found = config2.meshes.find((m) => m.slug === opts.meshSlug);
54950
+ if (!found) {
54951
+ console.error(`Mesh "${opts.meshSlug}" not found. Joined: ${config2.meshes.map((m) => m.slug).join(", ")}`);
54952
+ process.exit(1);
54953
+ }
54954
+ mesh = found;
54955
+ } else if (config2.meshes.length === 1) {
54956
+ mesh = config2.meshes[0];
54957
+ } else {
54958
+ mesh = await pickMesh2(config2.meshes);
54959
+ }
54960
+ const displayName = opts.displayName ?? config2.displayName ?? `${hostname3()}-${process.pid}`;
54961
+ const client2 = new BrokerClient(mesh, { displayName });
54962
+ try {
54963
+ await client2.connect();
54964
+ const result = await fn(client2, mesh);
54965
+ return result;
54966
+ } finally {
54967
+ client2.close();
54968
+ }
54969
+ }
54915
54970
 
54916
54971
  // src/commands/peers.ts
54917
54972
  init_config();
54918
- import { hostname as hostname3 } from "node:os";
54919
54973
  async function runPeers(flags) {
54920
54974
  const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
54921
54975
  const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
@@ -54923,56 +54977,53 @@ async function runPeers(flags) {
54923
54977
  const green2 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
54924
54978
  const yellow2 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
54925
54979
  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.");
54980
+ const slugs = flags.mesh ? [flags.mesh] : config2.meshes.map((m) => m.slug);
54981
+ if (slugs.length === 0) {
54982
+ console.error("No meshes joined. Run `claudemesh join <url>` first.");
54929
54983
  process.exit(1);
54930
54984
  }
54931
- const allPeers = [];
54932
- for (const mesh of meshes) {
54933
- const displayName = config2.displayName ?? `${hostname3()}-${process.pid}`;
54934
- const client2 = new BrokerClient(mesh, { displayName });
54985
+ const allJson = [];
54986
+ for (const slug of slugs) {
54935
54987
  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}`);
54988
+ await withMesh({ meshSlug: slug }, async (client2, mesh) => {
54989
+ const peers = await client2.listPeers();
54990
+ if (flags.json) {
54991
+ allJson.push({ mesh: mesh.slug, peers });
54992
+ return;
54964
54993
  }
54965
- }
54966
- console.log("");
54994
+ console.log(bold3(`Peers on ${mesh.slug}`) + dim2(` (${peers.length})`));
54995
+ console.log("");
54996
+ if (peers.length === 0) {
54997
+ console.log(dim2(" No peers connected."));
54998
+ } else {
54999
+ for (const p of peers) {
55000
+ const groups = p.groups.length ? " [" + p.groups.map((g) => `@${g.name}${g.role ? `:${g.role}` : ""}`).join(", ") + "]" : "";
55001
+ const statusIcon = p.status === "working" ? yellow2("●") : green2("●");
55002
+ const name = bold3(p.displayName);
55003
+ const meta2 = [];
55004
+ if (p.peerType)
55005
+ meta2.push(p.peerType);
55006
+ if (p.channel)
55007
+ meta2.push(p.channel);
55008
+ if (p.model)
55009
+ meta2.push(p.model);
55010
+ const metaStr = meta2.length ? dim2(` (${meta2.join(", ")})`) : "";
55011
+ const cwdStr = p.cwd ? dim2(` cwd: ${p.cwd}`) : "";
55012
+ const summary = p.summary ? dim2(` ${p.summary}`) : "";
55013
+ console.log(` ${statusIcon} ${name}${groups}${metaStr}${summary}`);
55014
+ if (cwdStr)
55015
+ console.log(` ${cwdStr}`);
55016
+ }
55017
+ }
55018
+ console.log("");
55019
+ });
54967
55020
  } catch (e) {
54968
- console.error(dim2(` Could not connect to ${mesh.slug}: ${e instanceof Error ? e.message : String(e)}`));
55021
+ console.error(dim2(` Could not connect to ${slug}: ${e instanceof Error ? e.message : String(e)}`));
54969
55022
  console.log("");
54970
- } finally {
54971
- client2.close();
54972
55023
  }
54973
55024
  }
54974
55025
  if (flags.json) {
54975
- console.log(JSON.stringify(meshes.length === 1 ? allPeers[0]?.peers : allPeers, null, 2));
55026
+ console.log(JSON.stringify(slugs.length === 1 ? allJson[0]?.peers : allJson, null, 2));
54976
55027
  }
54977
55028
  }
54978
55029
 
@@ -55087,7 +55138,7 @@ async function runWelcome() {
55087
55138
  console.log(dim(` ${url}
55088
55139
  `));
55089
55140
  const manualPromise = new Promise((resolve2) => {
55090
- const rl = createInterface2({ input: process.stdin, output: process.stdout });
55141
+ const rl = createInterface3({ input: process.stdin, output: process.stdout });
55091
55142
  rl.question(" Paste sync token (or wait for browser): ", (answer) => {
55092
55143
  rl.close();
55093
55144
  if (answer.trim())
@@ -55137,7 +55188,7 @@ async function runWelcome() {
55137
55188
  }
55138
55189
  if (choice === 1) {
55139
55190
  exitFullScreen();
55140
- const rl = createInterface2({ input: process.stdin, output: process.stdout });
55191
+ const rl = createInterface3({ input: process.stdin, output: process.stdout });
55141
55192
  const url = await new Promise((resolve2) => {
55142
55193
  rl.question(" Invite URL: ", (answer) => {
55143
55194
  rl.close();
@@ -55226,61 +55277,6 @@ function runWelcomePlain() {
55226
55277
  console.log("");
55227
55278
  }
55228
55279
 
55229
- // src/commands/connect.ts
55230
- import { hostname as hostname5 } from "node:os";
55231
- import { createInterface as createInterface3 } from "node:readline";
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
- }
55254
- async function withMesh(opts, fn) {
55255
- const config2 = loadConfig();
55256
- if (config2.meshes.length === 0) {
55257
- console.error("No meshes joined. Run `claudemesh join <url>` first.");
55258
- process.exit(1);
55259
- }
55260
- let mesh;
55261
- if (opts.meshSlug) {
55262
- const found = config2.meshes.find((m) => m.slug === opts.meshSlug);
55263
- if (!found) {
55264
- console.error(`Mesh "${opts.meshSlug}" not found. Joined: ${config2.meshes.map((m) => m.slug).join(", ")}`);
55265
- process.exit(1);
55266
- }
55267
- mesh = found;
55268
- } else if (config2.meshes.length === 1) {
55269
- mesh = config2.meshes[0];
55270
- } else {
55271
- mesh = await pickMesh2(config2.meshes);
55272
- }
55273
- const displayName = opts.displayName ?? config2.displayName ?? `${hostname5()}-${process.pid}`;
55274
- const client2 = new BrokerClient(mesh, { displayName });
55275
- try {
55276
- await client2.connect();
55277
- const result = await fn(client2, mesh);
55278
- return result;
55279
- } finally {
55280
- client2.close();
55281
- }
55282
- }
55283
-
55284
55280
  // src/commands/send.ts
55285
55281
  async function runSend(flags, to, message) {
55286
55282
  const priority = flags.priority === "now" ? "now" : flags.priority === "low" ? "low" : "next";
@@ -55746,7 +55742,7 @@ init_config();
55746
55742
  init_auth();
55747
55743
  init_keypair();
55748
55744
  import { createInterface as createInterface4 } from "node:readline";
55749
- import { hostname as hostname6 } from "node:os";
55745
+ import { hostname as hostname5 } from "node:os";
55750
55746
  async function runSync(args) {
55751
55747
  const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
55752
55748
  const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
@@ -55780,7 +55776,7 @@ async function runSync(args) {
55780
55776
  process.exit(1);
55781
55777
  }
55782
55778
  const keypair = config2.meshes.length > 0 ? { publicKey: config2.meshes[0].pubkey, secretKey: config2.meshes[0].secretKey } : await generateKeypair2();
55783
- const displayName = config2.displayName ?? `${hostname6()}-${process.pid}`;
55779
+ const displayName = config2.displayName ?? `${hostname5()}-${process.pid}`;
55784
55780
  const result = await syncWithBroker(syncToken, keypair.publicKey, displayName);
55785
55781
  let added = 0;
55786
55782
  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.2",
3
+ "version": "0.10.3",
4
4
  "description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -49,9 +49,9 @@
49
49
  "typescript": "5.9.3",
50
50
  "vitest": "4.0.14",
51
51
  "@turbostarter/tsconfig": "0.1.0",
52
+ "@turbostarter/prettier-config": "0.1.0",
52
53
  "@turbostarter/vitest-config": "0.1.0",
53
- "@turbostarter/eslint-config": "0.1.0",
54
- "@turbostarter/prettier-config": "0.1.0"
54
+ "@turbostarter/eslint-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",