claudemesh-cli 1.0.0-alpha.25 → 1.0.0-alpha.27
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/entrypoints/cli.js +50 -19
- package/dist/entrypoints/cli.js.map +9 -9
- package/package.json +1 -1
package/dist/entrypoints/cli.js
CHANGED
|
@@ -87,7 +87,7 @@ __export(exports_urls, {
|
|
|
87
87
|
VERSION: () => VERSION,
|
|
88
88
|
URLS: () => URLS
|
|
89
89
|
});
|
|
90
|
-
var URLS, VERSION = "1.0.0-alpha.
|
|
90
|
+
var URLS, VERSION = "1.0.0-alpha.27", env;
|
|
91
91
|
var init_urls = __esm(() => {
|
|
92
92
|
URLS = {
|
|
93
93
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -1125,7 +1125,7 @@ function validatePayload(obj) {
|
|
|
1125
1125
|
function canonicalInvite(p) {
|
|
1126
1126
|
return `${p.v}|${p.mesh_id}|${p.mesh_slug}|${p.broker_url}|${p.expires_at}|${p.mesh_root_key}|${p.role}|${p.owner_pubkey}`;
|
|
1127
1127
|
}
|
|
1128
|
-
function extractInviteToken(input) {
|
|
1128
|
+
async function extractInviteToken(input) {
|
|
1129
1129
|
const trimmed = input.trim();
|
|
1130
1130
|
if (trimmed.startsWith("ic://join/")) {
|
|
1131
1131
|
const token = trimmed.slice("ic://join/".length).replace(/\/$/, "");
|
|
@@ -1133,6 +1133,21 @@ function extractInviteToken(input) {
|
|
|
1133
1133
|
throw new Error("invite link has no payload");
|
|
1134
1134
|
return token;
|
|
1135
1135
|
}
|
|
1136
|
+
const shortMatch = trimmed.match(/^https?:\/\/([^/]+)(?:\/[a-z]{2})?\/i\/([A-Za-z0-9]+)\/?$/);
|
|
1137
|
+
if (shortMatch) {
|
|
1138
|
+
const host = shortMatch[1];
|
|
1139
|
+
const code = shortMatch[2];
|
|
1140
|
+
const res = await fetch(`https://${host}/api/public/invite-code/${code}`, {
|
|
1141
|
+
headers: { accept: "application/json" }
|
|
1142
|
+
});
|
|
1143
|
+
if (!res.ok) {
|
|
1144
|
+
throw new Error(`short invite code not found (status ${res.status})`);
|
|
1145
|
+
}
|
|
1146
|
+
const body = await res.json();
|
|
1147
|
+
if (!body.found)
|
|
1148
|
+
throw new Error("short invite code not found");
|
|
1149
|
+
return body.token;
|
|
1150
|
+
}
|
|
1136
1151
|
const httpsMatch = trimmed.match(/^https?:\/\/[^/]+(?:\/[a-z]{2})?\/join\/([A-Za-z0-9_-]+)\/?$/);
|
|
1137
1152
|
if (httpsMatch)
|
|
1138
1153
|
return httpsMatch[1];
|
|
@@ -1140,13 +1155,14 @@ function extractInviteToken(input) {
|
|
|
1140
1155
|
return trimmed;
|
|
1141
1156
|
}
|
|
1142
1157
|
throw new Error(`invalid invite format. Expected one of:
|
|
1158
|
+
` + ` https://claudemesh.com/i/<code>
|
|
1143
1159
|
` + ` https://claudemesh.com/join/<token>
|
|
1144
1160
|
` + ` ic://join/<token>
|
|
1145
1161
|
` + ` <raw-token>
|
|
1146
1162
|
` + `Got: "${input.slice(0, 40)}${input.length > 40 ? "…" : ""}"`);
|
|
1147
1163
|
}
|
|
1148
1164
|
async function parseInviteLink2(link) {
|
|
1149
|
-
const encoded = extractInviteToken(link);
|
|
1165
|
+
const encoded = await extractInviteToken(link);
|
|
1150
1166
|
let json;
|
|
1151
1167
|
try {
|
|
1152
1168
|
json = Buffer.from(encoded, "base64url").toString("utf-8");
|
|
@@ -4067,7 +4083,7 @@ async function runLaunch(flags, rawArgs) {
|
|
|
4067
4083
|
console.log("Joining mesh...");
|
|
4068
4084
|
const invite = await parseInviteLink(args.joinLink);
|
|
4069
4085
|
const keypair = await generateKeypair();
|
|
4070
|
-
const displayName2 = args.name ??
|
|
4086
|
+
const displayName2 = args.name ?? process.env.USER ?? process.env.USERNAME ?? hostname3();
|
|
4071
4087
|
const enroll = await enrollWithBroker({
|
|
4072
4088
|
brokerWsUrl: invite.payload.broker_url,
|
|
4073
4089
|
inviteToken: invite.token,
|
|
@@ -4136,7 +4152,7 @@ async function runLaunch(flags, rawArgs) {
|
|
|
4136
4152
|
}
|
|
4137
4153
|
const { generateKeypair: generateKeypair4 } = await Promise.resolve().then(() => (init_facade7(), exports_facade4));
|
|
4138
4154
|
const keypair = await generateKeypair4();
|
|
4139
|
-
const displayNameForSync = args.name ??
|
|
4155
|
+
const displayNameForSync = args.name ?? process.env.USER ?? process.env.USERNAME ?? hostname3();
|
|
4140
4156
|
const { syncWithBroker: syncWithBroker2 } = await Promise.resolve().then(() => (init_facade6(), exports_facade3));
|
|
4141
4157
|
const result2 = await syncWithBroker2(syncToken, keypair.publicKey, displayNameForSync);
|
|
4142
4158
|
const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade2));
|
|
@@ -4176,7 +4192,7 @@ async function runLaunch(flags, rawArgs) {
|
|
|
4176
4192
|
} else {
|
|
4177
4193
|
mesh = null;
|
|
4178
4194
|
}
|
|
4179
|
-
const displayName = args.name ??
|
|
4195
|
+
const displayName = args.name ?? process.env.USER ?? process.env.USERNAME ?? hostname3();
|
|
4180
4196
|
let role = args.role;
|
|
4181
4197
|
let parsedGroups = args.groups ? parseGroupsString(args.groups) : [];
|
|
4182
4198
|
let messageMode = args.messageMode ?? "push";
|
|
@@ -4898,10 +4914,19 @@ async function invite(email, opts = {}) {
|
|
|
4898
4914
|
console.log(JSON.stringify({ schema_version: "1.0", ...result, copied }, null, 2));
|
|
4899
4915
|
} else {
|
|
4900
4916
|
if (email) {
|
|
4901
|
-
|
|
4917
|
+
if (result.emailed) {
|
|
4918
|
+
console.log(`
|
|
4902
4919
|
${green(icons.check)} Invite sent to ${bold(email)}`);
|
|
4903
|
-
|
|
4904
|
-
|
|
4920
|
+
if (copied)
|
|
4921
|
+
console.log(` ${green(icons.check)} Link also copied to clipboard`);
|
|
4922
|
+
} else {
|
|
4923
|
+
console.log(`
|
|
4924
|
+
${icons.cross} Email to ${bold(email)} was NOT sent (server did not send).`);
|
|
4925
|
+
console.log(` ${dim("Share the link manually:")}`);
|
|
4926
|
+
console.log(` ${result.url}`);
|
|
4927
|
+
if (copied)
|
|
4928
|
+
console.log(` ${green(icons.check)} Link copied to clipboard`);
|
|
4929
|
+
}
|
|
4905
4930
|
} else {
|
|
4906
4931
|
console.log(`
|
|
4907
4932
|
${green(icons.check)} Invite link${copied ? " copied to clipboard" : ""}:`);
|
|
@@ -10000,7 +10025,7 @@ function renderVersion() {
|
|
|
10000
10025
|
|
|
10001
10026
|
// src/utils/url.ts
|
|
10002
10027
|
function isInviteUrl(input) {
|
|
10003
|
-
return /^https?:\/\/
|
|
10028
|
+
return /^https?:\/\/[^/]+\/(?:[a-z]{2}\/)?i\//.test(input) || /^https?:\/\/[^/]+\/(?:[a-z]{2}\/)?join\//.test(input) || /^ic:\/\//.test(input);
|
|
10004
10029
|
}
|
|
10005
10030
|
|
|
10006
10031
|
// src/entrypoints/cli.ts
|
|
@@ -10012,16 +10037,16 @@ claudemesh — peer mesh for Claude Code sessions
|
|
|
10012
10037
|
${VERSION}
|
|
10013
10038
|
|
|
10014
10039
|
USAGE
|
|
10015
|
-
claudemesh
|
|
10016
|
-
claudemesh <invite-url>
|
|
10040
|
+
claudemesh auto-connect to your mesh
|
|
10041
|
+
claudemesh <invite-url> join a mesh, then launch
|
|
10042
|
+
claudemesh launch --name <n> --join <url> join + launch in one step
|
|
10017
10043
|
|
|
10018
10044
|
Mesh
|
|
10019
10045
|
claudemesh create <name> create a new mesh
|
|
10020
|
-
claudemesh
|
|
10021
|
-
claudemesh
|
|
10022
|
-
claudemesh
|
|
10023
|
-
claudemesh
|
|
10024
|
-
claudemesh delete [slug] delete a mesh
|
|
10046
|
+
claudemesh join <url> join a mesh (accepts short /i/ or long /join/ link)
|
|
10047
|
+
claudemesh launch [slug] launch Claude Code on a mesh (alias: connect)
|
|
10048
|
+
claudemesh list show your meshes (alias: ls)
|
|
10049
|
+
claudemesh delete [slug] delete a mesh (alias: rm)
|
|
10025
10050
|
claudemesh rename <slug> <name> rename a mesh
|
|
10026
10051
|
claudemesh share [email] share mesh (invite link / send email)
|
|
10027
10052
|
|
|
@@ -10107,7 +10132,13 @@ async function main() {
|
|
|
10107
10132
|
case "connect":
|
|
10108
10133
|
case "launch": {
|
|
10109
10134
|
const { runLaunch: runLaunch2 } = await Promise.resolve().then(() => (init_launch(), exports_launch));
|
|
10110
|
-
await runLaunch2({
|
|
10135
|
+
await runLaunch2({
|
|
10136
|
+
mesh: positionals[0] ?? flags.mesh,
|
|
10137
|
+
name: flags.name,
|
|
10138
|
+
join: flags.join,
|
|
10139
|
+
yes: !!flags.y || !!flags.yes,
|
|
10140
|
+
resume: flags.resume
|
|
10141
|
+
}, process.argv.slice(2));
|
|
10111
10142
|
break;
|
|
10112
10143
|
}
|
|
10113
10144
|
case "disconnect": {
|
|
@@ -10269,4 +10300,4 @@ main().catch((err) => {
|
|
|
10269
10300
|
process.exit(EXIT.INTERNAL_ERROR);
|
|
10270
10301
|
});
|
|
10271
10302
|
|
|
10272
|
-
//# debugId=
|
|
10303
|
+
//# debugId=80BE52F159268C1464756E2164756E21
|