MCPcopy Create free account
hub / github.com/block/buzz / initFirstWorkspace

Function initFirstWorkspace

desktop/src/features/workspaces/workspaceStorage.ts:112–129  ·  view source on GitHub ↗
(
  relayUrl: string,
  pubkey: string,
  name?: string,
)

Source from the content-addressed store, hash-verified

110}
111
112export function initFirstWorkspace(
113 relayUrl: string,
114 pubkey: string,
115 name?: string,
116): Workspace {
117 const normalizedUrl = normalizeRelayUrl(relayUrl);
118 const trimmedName = name?.trim();
119 const workspace: Workspace = {
120 id: crypto.randomUUID(),
121 name: trimmedName || deriveWorkspaceName(normalizedUrl),
122 relayUrl: normalizedUrl,
123 pubkey,
124 addedAt: new Date().toISOString(),
125 };
126 saveWorkspaces([workspace]);
127 saveActiveWorkspaceId(workspace.id);
128 return workspace;
129}

Callers 2

initFunction · 0.90
WelcomeSetupFunction · 0.90

Calls 4

deriveWorkspaceNameFunction · 0.85
saveWorkspacesFunction · 0.85
saveActiveWorkspaceIdFunction · 0.85
normalizeRelayUrlFunction · 0.70

Tested by

no test coverage detected