MCPcopy
hub / github.com/coder/mux / buildFallbackWorkspaceIdentity

Function buildFallbackWorkspaceIdentity

src/browser/hooks/useWorkspaceName.ts:29–40  ·  view source on GitHub ↗
(message: string)

Source from the content-addressed store, hash-verified

27}
28
29function buildFallbackWorkspaceIdentity(message: string): WorkspaceIdentity {
30 const normalized = message
31 .trim()
32 .replace(/^\/+/, "")
33 .toLowerCase()
34 .replace(/[^a-z0-9]+/g, "-")
35 .replace(/^-+|-+$/g, "")
36 .slice(0, 48)
37 .replace(/-+$/g, "");
38 const name = normalized && !validateWorkspaceName(normalized).error ? normalized : "workspace";
39 return { name, title: name };
40}
41
42export interface UseWorkspaceNameOptions {
43 /** The user's message to generate a name for */

Callers 1

useWorkspaceNameFunction · 0.85

Calls 1

validateWorkspaceNameFunction · 0.90

Tested by

no test coverage detected