claudemesh-cli 0.10.1 → 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.
- package/dist/index.js +129 -134
- 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.3",
|
|
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,125 @@ 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
|
|
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
|
+
}
|
|
54970
|
+
|
|
54971
|
+
// src/commands/peers.ts
|
|
54972
|
+
init_config();
|
|
54973
|
+
async function runPeers(flags) {
|
|
54974
|
+
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
54975
|
+
const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
|
|
54976
|
+
const bold3 = (s) => useColor ? `\x1B[1m${s}\x1B[22m` : s;
|
|
54977
|
+
const green2 = (s) => useColor ? `\x1B[32m${s}\x1B[39m` : s;
|
|
54978
|
+
const yellow2 = (s) => useColor ? `\x1B[33m${s}\x1B[39m` : s;
|
|
54979
|
+
const config2 = loadConfig();
|
|
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.");
|
|
54983
|
+
process.exit(1);
|
|
54984
|
+
}
|
|
54985
|
+
const allJson = [];
|
|
54986
|
+
for (const slug of slugs) {
|
|
54987
|
+
try {
|
|
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;
|
|
54993
|
+
}
|
|
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
|
+
});
|
|
55020
|
+
} catch (e) {
|
|
55021
|
+
console.error(dim2(` Could not connect to ${slug}: ${e instanceof Error ? e.message : String(e)}`));
|
|
55022
|
+
console.log("");
|
|
55023
|
+
}
|
|
55024
|
+
}
|
|
55025
|
+
if (flags.json) {
|
|
55026
|
+
console.log(JSON.stringify(slugs.length === 1 ? allJson[0]?.peers : allJson, null, 2));
|
|
55027
|
+
}
|
|
55028
|
+
}
|
|
55029
|
+
|
|
55030
|
+
// src/commands/welcome.ts
|
|
54915
55031
|
init_colors();
|
|
54916
55032
|
init_spinner();
|
|
54917
55033
|
function detectState() {
|
|
@@ -55022,7 +55138,7 @@ async function runWelcome() {
|
|
|
55022
55138
|
console.log(dim(` ${url}
|
|
55023
55139
|
`));
|
|
55024
55140
|
const manualPromise = new Promise((resolve2) => {
|
|
55025
|
-
const rl =
|
|
55141
|
+
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
55026
55142
|
rl.question(" Paste sync token (or wait for browser): ", (answer) => {
|
|
55027
55143
|
rl.close();
|
|
55028
55144
|
if (answer.trim())
|
|
@@ -55045,7 +55161,7 @@ async function runWelcome() {
|
|
|
55045
55161
|
}
|
|
55046
55162
|
const { generateKeypair: generateKeypair3 } = await Promise.resolve().then(() => (init_keypair(), exports_keypair));
|
|
55047
55163
|
const keypair = await generateKeypair3();
|
|
55048
|
-
const displayName = `${
|
|
55164
|
+
const displayName = `${hostname4()}-${process.pid}`;
|
|
55049
55165
|
const { syncWithBroker: syncWithBroker2 } = await Promise.resolve().then(() => exports_sync_with_broker);
|
|
55050
55166
|
const result = await syncWithBroker2(syncToken, keypair.publicKey, displayName);
|
|
55051
55167
|
const config2 = loadConfig();
|
|
@@ -55072,7 +55188,7 @@ async function runWelcome() {
|
|
|
55072
55188
|
}
|
|
55073
55189
|
if (choice === 1) {
|
|
55074
55190
|
exitFullScreen();
|
|
55075
|
-
const rl =
|
|
55191
|
+
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
55076
55192
|
const url = await new Promise((resolve2) => {
|
|
55077
55193
|
rl.question(" Invite URL: ", (answer) => {
|
|
55078
55194
|
rl.close();
|
|
@@ -55110,17 +55226,14 @@ async function runWelcome() {
|
|
|
55110
55226
|
await runLaunch({}, []);
|
|
55111
55227
|
return;
|
|
55112
55228
|
case 1:
|
|
55113
|
-
|
|
55114
|
-
|
|
55115
|
-
break;
|
|
55229
|
+
await runPeers({});
|
|
55230
|
+
return;
|
|
55116
55231
|
case 2:
|
|
55117
|
-
|
|
55118
|
-
|
|
55119
|
-
break;
|
|
55232
|
+
await runStatus();
|
|
55233
|
+
return;
|
|
55120
55234
|
case 3:
|
|
55121
|
-
|
|
55122
|
-
|
|
55123
|
-
break;
|
|
55235
|
+
await runDoctor();
|
|
55236
|
+
return;
|
|
55124
55237
|
}
|
|
55125
55238
|
return;
|
|
55126
55239
|
}
|
|
@@ -55164,124 +55277,6 @@ function runWelcomePlain() {
|
|
|
55164
55277
|
console.log("");
|
|
55165
55278
|
}
|
|
55166
55279
|
|
|
55167
|
-
// src/commands/peers.ts
|
|
55168
|
-
init_config();
|
|
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";
|
|
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
|
-
}
|
|
55255
|
-
async function withMesh(opts, fn) {
|
|
55256
|
-
const config2 = loadConfig();
|
|
55257
|
-
if (config2.meshes.length === 0) {
|
|
55258
|
-
console.error("No meshes joined. Run `claudemesh join <url>` first.");
|
|
55259
|
-
process.exit(1);
|
|
55260
|
-
}
|
|
55261
|
-
let mesh;
|
|
55262
|
-
if (opts.meshSlug) {
|
|
55263
|
-
const found = config2.meshes.find((m) => m.slug === opts.meshSlug);
|
|
55264
|
-
if (!found) {
|
|
55265
|
-
console.error(`Mesh "${opts.meshSlug}" not found. Joined: ${config2.meshes.map((m) => m.slug).join(", ")}`);
|
|
55266
|
-
process.exit(1);
|
|
55267
|
-
}
|
|
55268
|
-
mesh = found;
|
|
55269
|
-
} else if (config2.meshes.length === 1) {
|
|
55270
|
-
mesh = config2.meshes[0];
|
|
55271
|
-
} else {
|
|
55272
|
-
mesh = await pickMesh2(config2.meshes);
|
|
55273
|
-
}
|
|
55274
|
-
const displayName = opts.displayName ?? config2.displayName ?? `${hostname5()}-${process.pid}`;
|
|
55275
|
-
const client2 = new BrokerClient(mesh, { displayName });
|
|
55276
|
-
try {
|
|
55277
|
-
await client2.connect();
|
|
55278
|
-
const result = await fn(client2, mesh);
|
|
55279
|
-
return result;
|
|
55280
|
-
} finally {
|
|
55281
|
-
client2.close();
|
|
55282
|
-
}
|
|
55283
|
-
}
|
|
55284
|
-
|
|
55285
55280
|
// src/commands/send.ts
|
|
55286
55281
|
async function runSend(flags, to, message) {
|
|
55287
55282
|
const priority = flags.priority === "now" ? "now" : flags.priority === "low" ? "low" : "next";
|
|
@@ -55747,7 +55742,7 @@ init_config();
|
|
|
55747
55742
|
init_auth();
|
|
55748
55743
|
init_keypair();
|
|
55749
55744
|
import { createInterface as createInterface4 } from "node:readline";
|
|
55750
|
-
import { hostname as
|
|
55745
|
+
import { hostname as hostname5 } from "node:os";
|
|
55751
55746
|
async function runSync(args) {
|
|
55752
55747
|
const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
|
|
55753
55748
|
const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
|
|
@@ -55781,7 +55776,7 @@ async function runSync(args) {
|
|
|
55781
55776
|
process.exit(1);
|
|
55782
55777
|
}
|
|
55783
55778
|
const keypair = config2.meshes.length > 0 ? { publicKey: config2.meshes[0].pubkey, secretKey: config2.meshes[0].secretKey } : await generateKeypair2();
|
|
55784
|
-
const displayName = config2.displayName ?? `${
|
|
55779
|
+
const displayName = config2.displayName ?? `${hostname5()}-${process.pid}`;
|
|
55785
55780
|
const result = await syncWithBroker(syncToken, keypair.publicKey, displayName);
|
|
55786
55781
|
let added = 0;
|
|
55787
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.
|
|
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",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"prettier": "3.6.2",
|
|
49
49
|
"typescript": "5.9.3",
|
|
50
50
|
"vitest": "4.0.14",
|
|
51
|
-
"@turbostarter/vitest-config": "0.1.0",
|
|
52
51
|
"@turbostarter/tsconfig": "0.1.0",
|
|
53
52
|
"@turbostarter/prettier-config": "0.1.0",
|
|
53
|
+
"@turbostarter/vitest-config": "0.1.0",
|
|
54
54
|
"@turbostarter/eslint-config": "0.1.0"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|