fix(cli): short-circuit join <slug> when already a member (alpha.41)
If the arg isn't a URL and matches a mesh already in local config, print a hint pointing at `launch --mesh <slug>` instead of treating the slug as an invite code. Avoids the 501 invite_v2_disabled confusion when users try to "enter" a mesh they already own. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "claudemesh-cli",
|
"name": "claudemesh-cli",
|
||||||
"version": "1.0.0-alpha.40",
|
"version": "1.0.0-alpha.41",
|
||||||
"description": "Peer mesh for Claude Code sessions — CLI + MCP server.",
|
"description": "Peer mesh for Claude Code sessions — CLI + MCP server.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"claude-code",
|
"claude-code",
|
||||||
|
|||||||
@@ -111,6 +111,24 @@ export async function runJoin(args: string[]): Promise<void> {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Short-circuit: if the arg matches a mesh already in local config (slug
|
||||||
|
// or name), we're already joined. Don't go through the invite flow.
|
||||||
|
if (!link.includes("://")) {
|
||||||
|
const existing = readConfig().meshes.find(
|
||||||
|
(m) => m.slug === link || m.name === link,
|
||||||
|
);
|
||||||
|
if (existing) {
|
||||||
|
console.log(`Already in "${existing.slug}" on this machine.`);
|
||||||
|
console.log("");
|
||||||
|
console.log(`Use it in the current directory:`);
|
||||||
|
console.log(` claudemesh launch --mesh ${existing.slug}`);
|
||||||
|
console.log("");
|
||||||
|
console.log(`Or list peers:`);
|
||||||
|
console.log(` claudemesh peers --mesh ${existing.slug}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Try v2 first — short code / `/i/<code>` URL.
|
// Try v2 first — short code / `/i/<code>` URL.
|
||||||
const v2Code = parseV2InviteInput(link);
|
const v2Code = parseV2InviteInput(link);
|
||||||
if (v2Code) {
|
if (v2Code) {
|
||||||
|
|||||||
Reference in New Issue
Block a user