MCPcopy Create free account
hub / github.com/experdot/pointer / switchWorkspace

Function switchWorkspace

src/renderer/src/services/workspaceService.ts:111–127  ·  view source on GitHub ↗
(workspaceId: string)

Source from the content-addressed store, hash-verified

109 * 切换工作区
110 */
111export async function switchWorkspace(workspaceId: string): Promise<void> {
112 const { workspace } = stores
113
114 // 验证工作区存在
115 const targetWorkspace = await workspace.getById(workspaceId)
116 if (!targetWorkspace) {
117 throw new Error(`Workspace not found: ${workspaceId}`)
118 }
119
120 await runSwitchTransaction('workspace', targetWorkspace.name, async () => {
121 await workspace.setCurrentWorkspaceId(workspaceId)
122 await commitWorkspaceContext(targetWorkspace.accountId, targetWorkspace.path)
123 await cleanupWorkspaceTempAttachments()
124 resetWorkspaceStores()
125 await initWorkspaceStores()
126 })
127}
128
129// ==================== 自定义工作区 ====================
130

Callers 3

handleSwitchWorkspaceFunction · 0.90
openFolderAsWorkspaceFunction · 0.85
deleteWorkspaceFunction · 0.85

Calls 7

runSwitchTransactionFunction · 0.90
commitWorkspaceContextFunction · 0.85
resetWorkspaceStoresFunction · 0.85
initWorkspaceStoresFunction · 0.85
getByIdMethod · 0.65
setCurrentWorkspaceIdMethod · 0.65

Tested by

no test coverage detected