feat: collapse mesh.name and mesh.slug into one identifier (v1.21.0)
Pre-launch fix: every visible surface already keyed on slug, so
"name" was a parallel string that only existed to confuse users
on rename ("I renamed but nothing visible changed").
Now slug IS the identifier. claudemesh rename <old> <new> is the
whole rename surface. PATCH /api/cli/meshes/:slug body becomes
{ slug } and the route writes both columns to keep them in sync.
Mesh create derives slug from input.name and stores name = slug.
Pickers drop the (parens). The claudemesh slug verb shipped 30
min ago is removed — merged into rename.
The mesh.name DB column stays for now to avoid touching ~25
reader sites; a follow-up migration drops it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,20 +19,13 @@ export async function createMesh(
|
||||
return post<{ id: string; slug: string; name: string }>("/api/my/meshes", body, token);
|
||||
}
|
||||
|
||||
export async function renameMesh(token: string, slug: string, newName: string) {
|
||||
export async function renameMesh(token: string, oldSlug: string, newSlug: string) {
|
||||
// Routed through /api/cli/* (not /api/my/*) because the CLI JWT
|
||||
// can't authenticate against the better-auth-protected myRouter.
|
||||
// The /api/cli/meshes/:slug route validates the JWT inline.
|
||||
return request<{ slug: string; name: string }>({
|
||||
path: `/api/cli/meshes/${slug}`,
|
||||
method: "PATCH",
|
||||
body: { name: newName },
|
||||
token,
|
||||
});
|
||||
}
|
||||
|
||||
export async function reslugMesh(token: string, oldSlug: string, newSlug: string) {
|
||||
return request<{ slug: string; name: string }>({
|
||||
// v0.7.0 collapse: rename = change slug. mesh.name kept in sync
|
||||
// server-side (column stays for now, value mirrors slug).
|
||||
return request<{ slug: string }>({
|
||||
path: `/api/cli/meshes/${oldSlug}`,
|
||||
method: "PATCH",
|
||||
body: { slug: newSlug },
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
export { listMeshes as list } from "./list.js";
|
||||
export { createMesh as create } from "./create.js";
|
||||
export { renameMesh as rename } from "./rename.js";
|
||||
export { reslugMesh as reslug } from "./reslug.js";
|
||||
export { renameMesh as rename, renameMesh as reslug } from "./rename.js";
|
||||
export { leaveMesh as leave } from "./leave.js";
|
||||
export { joinMesh as join, joinMesh } from "./join.js";
|
||||
export { resolveTarget } from "./resolve-target.js";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { my } from "~/services/api/facade.js";
|
||||
import { getStoredToken } from "~/services/auth/facade.js";
|
||||
|
||||
export async function renameMesh(slug: string, newName: string): Promise<void> {
|
||||
export async function renameMesh(oldSlug: string, newSlug: string): Promise<{ slug: string }> {
|
||||
const auth = getStoredToken();
|
||||
if (!auth) throw new Error("Not signed in");
|
||||
await my.renameMesh(auth.session_token, slug, newName);
|
||||
return await my.renameMesh(auth.session_token, oldSlug, newSlug);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import { my } from "~/services/api/facade.js";
|
||||
import { getStoredToken } from "~/services/auth/facade.js";
|
||||
|
||||
export async function reslugMesh(oldSlug: string, newSlug: string): Promise<{ slug: string; name: string }> {
|
||||
const auth = getStoredToken();
|
||||
if (!auth) throw new Error("Not signed in");
|
||||
return await my.reslugMesh(auth.session_token, oldSlug, newSlug);
|
||||
}
|
||||
Reference in New Issue
Block a user