claudemesh-cli 0.10.0 → 0.10.1
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/index.js +93 -51
- package/package.json +2 -2
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.
|
|
40192
|
+
version: "0.10.1",
|
|
40193
40193
|
description: "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
|
|
40194
40194
|
keywords: [
|
|
40195
40195
|
"claude-code",
|
|
@@ -55164,9 +55164,94 @@ function runWelcomePlain() {
|
|
|
55164
55164
|
console.log("");
|
|
55165
55165
|
}
|
|
55166
55166
|
|
|
55167
|
-
// src/commands/
|
|
55167
|
+
// src/commands/peers.ts
|
|
55168
|
+
init_config();
|
|
55168
55169
|
import { hostname as hostname4 } from "node:os";
|
|
55170
|
+
async function runPeers(flags) {
|
|
55171
|
+
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
55172
|
+
const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
|
|
55173
|
+
const bold3 = (s) => useColor ? `\x1B[1m${s}\x1B[22m` : s;
|
|
55174
|
+
const green2 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
|
|
55175
|
+
const yellow2 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
|
|
55176
|
+
const config2 = loadConfig();
|
|
55177
|
+
const meshes = flags.mesh ? config2.meshes.filter((m) => m.slug === flags.mesh) : config2.meshes;
|
|
55178
|
+
if (meshes.length === 0) {
|
|
55179
|
+
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.");
|
|
55180
|
+
process.exit(1);
|
|
55181
|
+
}
|
|
55182
|
+
const allPeers = [];
|
|
55183
|
+
for (const mesh of meshes) {
|
|
55184
|
+
const displayName = config2.displayName ?? `${hostname4()}-${process.pid}`;
|
|
55185
|
+
const client2 = new BrokerClient(mesh, { displayName });
|
|
55186
|
+
try {
|
|
55187
|
+
await client2.connect();
|
|
55188
|
+
const peers = await client2.listPeers();
|
|
55189
|
+
if (flags.json) {
|
|
55190
|
+
allPeers.push({ mesh: mesh.slug, peers });
|
|
55191
|
+
continue;
|
|
55192
|
+
}
|
|
55193
|
+
console.log(bold3(`Peers on ${mesh.slug}`) + dim2(` (${peers.length})`));
|
|
55194
|
+
console.log("");
|
|
55195
|
+
if (peers.length === 0) {
|
|
55196
|
+
console.log(dim2(" No peers connected."));
|
|
55197
|
+
} else {
|
|
55198
|
+
for (const p of peers) {
|
|
55199
|
+
const groups = p.groups.length ? " [" + p.groups.map((g) => `@${g.name}${g.role ? `:${g.role}` : ""}`).join(", ") + "]" : "";
|
|
55200
|
+
const statusIcon = p.status === "working" ? yellow2("●") : green2("●");
|
|
55201
|
+
const name = bold3(p.displayName);
|
|
55202
|
+
const meta2 = [];
|
|
55203
|
+
if (p.peerType)
|
|
55204
|
+
meta2.push(p.peerType);
|
|
55205
|
+
if (p.channel)
|
|
55206
|
+
meta2.push(p.channel);
|
|
55207
|
+
if (p.model)
|
|
55208
|
+
meta2.push(p.model);
|
|
55209
|
+
const metaStr = meta2.length ? dim2(` (${meta2.join(", ")})`) : "";
|
|
55210
|
+
const cwdStr = p.cwd ? dim2(` cwd: ${p.cwd}`) : "";
|
|
55211
|
+
const summary = p.summary ? dim2(` ${p.summary}`) : "";
|
|
55212
|
+
console.log(` ${statusIcon} ${name}${groups}${metaStr}${summary}`);
|
|
55213
|
+
if (cwdStr)
|
|
55214
|
+
console.log(` ${cwdStr}`);
|
|
55215
|
+
}
|
|
55216
|
+
}
|
|
55217
|
+
console.log("");
|
|
55218
|
+
} catch (e) {
|
|
55219
|
+
console.error(dim2(` Could not connect to ${mesh.slug}: ${e instanceof Error ? e.message : String(e)}`));
|
|
55220
|
+
console.log("");
|
|
55221
|
+
} finally {
|
|
55222
|
+
client2.close();
|
|
55223
|
+
}
|
|
55224
|
+
}
|
|
55225
|
+
if (flags.json) {
|
|
55226
|
+
console.log(JSON.stringify(meshes.length === 1 ? allPeers[0]?.peers : allPeers, null, 2));
|
|
55227
|
+
}
|
|
55228
|
+
}
|
|
55229
|
+
|
|
55230
|
+
// src/commands/connect.ts
|
|
55231
|
+
import { hostname as hostname5 } from "node:os";
|
|
55232
|
+
import { createInterface as createInterface3 } from "node:readline";
|
|
55169
55233
|
init_config();
|
|
55234
|
+
async function pickMesh2(meshes) {
|
|
55235
|
+
console.log(`
|
|
55236
|
+
Select mesh:`);
|
|
55237
|
+
meshes.forEach((m, i) => {
|
|
55238
|
+
console.log(` ${i + 1}) ${m.slug}`);
|
|
55239
|
+
});
|
|
55240
|
+
console.log("");
|
|
55241
|
+
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
55242
|
+
return new Promise((resolve2) => {
|
|
55243
|
+
rl.question(" Choice [1]: ", (answer) => {
|
|
55244
|
+
rl.close();
|
|
55245
|
+
const idx = parseInt(answer || "1", 10) - 1;
|
|
55246
|
+
if (idx >= 0 && idx < meshes.length) {
|
|
55247
|
+
resolve2(meshes[idx]);
|
|
55248
|
+
} else {
|
|
55249
|
+
console.error(" Invalid choice, using first mesh.");
|
|
55250
|
+
resolve2(meshes[0]);
|
|
55251
|
+
}
|
|
55252
|
+
});
|
|
55253
|
+
});
|
|
55254
|
+
}
|
|
55170
55255
|
async function withMesh(opts, fn) {
|
|
55171
55256
|
const config2 = loadConfig();
|
|
55172
55257
|
if (config2.meshes.length === 0) {
|
|
@@ -55184,11 +55269,9 @@ async function withMesh(opts, fn) {
|
|
|
55184
55269
|
} else if (config2.meshes.length === 1) {
|
|
55185
55270
|
mesh = config2.meshes[0];
|
|
55186
55271
|
} else {
|
|
55187
|
-
|
|
55188
|
-
Joined: ${config2.meshes.map((m) => m.slug).join(", ")}`);
|
|
55189
|
-
process.exit(1);
|
|
55272
|
+
mesh = await pickMesh2(config2.meshes);
|
|
55190
55273
|
}
|
|
55191
|
-
const displayName = opts.displayName ?? config2.displayName ?? `${
|
|
55274
|
+
const displayName = opts.displayName ?? config2.displayName ?? `${hostname5()}-${process.pid}`;
|
|
55192
55275
|
const client2 = new BrokerClient(mesh, { displayName });
|
|
55193
55276
|
try {
|
|
55194
55277
|
await client2.connect();
|
|
@@ -55199,47 +55282,6 @@ Joined: ${config2.meshes.map((m) => m.slug).join(", ")}`);
|
|
|
55199
55282
|
}
|
|
55200
55283
|
}
|
|
55201
55284
|
|
|
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
55285
|
// src/commands/send.ts
|
|
55244
55286
|
async function runSend(flags, to, message) {
|
|
55245
55287
|
const priority = flags.priority === "now" ? "now" : flags.priority === "low" ? "low" : "next";
|
|
@@ -55704,8 +55746,8 @@ function runCreate(args) {
|
|
|
55704
55746
|
init_config();
|
|
55705
55747
|
init_auth();
|
|
55706
55748
|
init_keypair();
|
|
55707
|
-
import { createInterface as
|
|
55708
|
-
import { hostname as
|
|
55749
|
+
import { createInterface as createInterface4 } from "node:readline";
|
|
55750
|
+
import { hostname as hostname6 } from "node:os";
|
|
55709
55751
|
async function runSync(args) {
|
|
55710
55752
|
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
55711
55753
|
const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
|
|
@@ -55718,7 +55760,7 @@ async function runSync(args) {
|
|
|
55718
55760
|
console.log(dim2(`Visit: ${url}`));
|
|
55719
55761
|
await openBrowser(url);
|
|
55720
55762
|
const manualPromise = new Promise((resolve2) => {
|
|
55721
|
-
const rl =
|
|
55763
|
+
const rl = createInterface4({ input: process.stdin, output: process.stdout });
|
|
55722
55764
|
rl.question("Paste sync token (or wait for browser): ", (answer) => {
|
|
55723
55765
|
rl.close();
|
|
55724
55766
|
if (answer.trim())
|
|
@@ -55739,7 +55781,7 @@ async function runSync(args) {
|
|
|
55739
55781
|
process.exit(1);
|
|
55740
55782
|
}
|
|
55741
55783
|
const keypair = config2.meshes.length > 0 ? { publicKey: config2.meshes[0].pubkey, secretKey: config2.meshes[0].secretKey } : await generateKeypair2();
|
|
55742
|
-
const displayName = config2.displayName ?? `${
|
|
55784
|
+
const displayName = config2.displayName ?? `${hostname6()}-${process.pid}`;
|
|
55743
55785
|
const result = await syncWithBroker(syncToken, keypair.publicKey, displayName);
|
|
55744
55786
|
let added = 0;
|
|
55745
55787
|
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.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -48,9 +48,9 @@
|
|
|
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
51
|
"@turbostarter/vitest-config": "0.1.0",
|
|
53
52
|
"@turbostarter/tsconfig": "0.1.0",
|
|
53
|
+
"@turbostarter/prettier-config": "0.1.0",
|
|
54
54
|
"@turbostarter/eslint-config": "0.1.0"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|