fix(cli): rename syncs local config + picker shows display name
After renaming the mesh display name on the server, the launch
picker still showed the slug ("flexicar-2") because (a) local
config.json was not updated and (b) the picker only printed
mesh.slug. Now: rename writes the new name back into config.json
on success, and the picker prints "name (slug)" when they differ.
Also surfaces a hint that slugs are immutable (today).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claudemesh-cli",
|
||||
"version": "1.19.2",
|
||||
"version": "1.19.3",
|
||||
"description": "Peer mesh for Claude Code sessions — CLI + MCP server.",
|
||||
"keywords": [
|
||||
"claude-code",
|
||||
|
||||
@@ -49,7 +49,8 @@ async function pickMesh(meshes: JoinedMesh[]): Promise<JoinedMesh> {
|
||||
|
||||
console.log("\n Select mesh:");
|
||||
meshes.forEach((m, i) => {
|
||||
console.log(` ${i + 1}) ${m.slug}`);
|
||||
const label = m.name && m.name !== m.slug ? `${m.name} \x1b[2m(${m.slug})\x1b[0m` : m.slug;
|
||||
console.log(` ${i + 1}) ${label}`);
|
||||
});
|
||||
console.log("");
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { rename as renameMesh } from "~/services/mesh/facade.js";
|
||||
import { getStoredToken } from "~/services/auth/facade.js";
|
||||
import { ApiError } from "~/services/api/facade.js";
|
||||
import { readConfig, setMeshConfig } from "~/services/config/facade.js";
|
||||
import { bold, dim, green, icons } from "~/ui/styles.js";
|
||||
import { EXIT } from "~/constants/exit-codes.js";
|
||||
|
||||
@@ -19,7 +20,13 @@ export async function rename(slug: string, newName: string): Promise<number> {
|
||||
|
||||
try {
|
||||
await renameMesh(slug, newName);
|
||||
// Sync the new name into local config so launch / picker
|
||||
// reflect the change without waiting for the next sync.
|
||||
const cfg = readConfig();
|
||||
const local = cfg.meshes.find((m) => m.slug === slug);
|
||||
if (local) setMeshConfig(slug, { ...local, name: newName });
|
||||
console.log(` ${green(icons.check)} Renamed "${slug}" to "${newName}"`);
|
||||
console.log(` ${dim("(slug stays \"" + slug + "\" — only the display name changed)")}`);
|
||||
return EXIT.SUCCESS;
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError) {
|
||||
|
||||
Reference in New Issue
Block a user