claudemesh-cli 1.0.0-alpha.26 → 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.
@@ -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.0", env;
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 ?? `${hostname3()}-${process.pid}`;
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 ?? `${hostname3()}-${process.pid}`;
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 ?? `${hostname3()}-${process.pid}`;
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";
@@ -10009,7 +10025,7 @@ function renderVersion() {
10009
10025
 
10010
10026
  // src/utils/url.ts
10011
10027
  function isInviteUrl(input) {
10012
- return /^https?:\/\/claudemesh\.com\/i\//.test(input) || /^ic:\/\//.test(input);
10028
+ return /^https?:\/\/[^/]+\/(?:[a-z]{2}\/)?i\//.test(input) || /^https?:\/\/[^/]+\/(?:[a-z]{2}\/)?join\//.test(input) || /^ic:\/\//.test(input);
10013
10029
  }
10014
10030
 
10015
10031
  // src/entrypoints/cli.ts
@@ -10021,16 +10037,16 @@ claudemesh — peer mesh for Claude Code sessions
10021
10037
  ${VERSION}
10022
10038
 
10023
10039
  USAGE
10024
- claudemesh auto-connect to your mesh
10025
- claudemesh <invite-url> join a mesh from an invite link
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
10026
10043
 
10027
10044
  Mesh
10028
10045
  claudemesh create <name> create a new mesh
10029
- claudemesh add <url> join a mesh from invite link
10030
- claudemesh connect [slug] establish connection to a mesh
10031
- claudemesh disconnect close the active connection
10032
- claudemesh list show your meshes
10033
- 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)
10034
10050
  claudemesh rename <slug> <name> rename a mesh
10035
10051
  claudemesh share [email] share mesh (invite link / send email)
10036
10052
 
@@ -10116,7 +10132,13 @@ async function main() {
10116
10132
  case "connect":
10117
10133
  case "launch": {
10118
10134
  const { runLaunch: runLaunch2 } = await Promise.resolve().then(() => (init_launch(), exports_launch));
10119
- await runLaunch2({ mesh: positionals[0] ?? flags.mesh, name: flags.name, yes: !!flags.y || !!flags.yes, resume: flags.resume }, process.argv.slice(2));
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));
10120
10142
  break;
10121
10143
  }
10122
10144
  case "disconnect": {
@@ -10278,4 +10300,4 @@ main().catch((err) => {
10278
10300
  process.exit(EXIT.INTERNAL_ERROR);
10279
10301
  });
10280
10302
 
10281
- //# debugId=3B0AB051A285774164756E2164756E21
10303
+ //# debugId=80BE52F159268C1464756E2164756E21