(message: string)
| 27 | } |
| 28 | |
| 29 | function 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 | |
| 42 | export interface UseWorkspaceNameOptions { |
| 43 | /** The user's message to generate a name for */ |
no test coverage detected