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

Method forkWorkspace

src/node/runtime/LocalRuntime.ts:141–165  ·  view source on GitHub ↗

* Fork for LocalRuntime creates a new workspace entry pointing to the same project directory. * Since LocalRuntime doesn't create separate directories, "forking" just means: * 1. A new workspace ID with the new name * 2. Copied chat history (handled by workspaceService) * 3. Same project

(params: WorkspaceForkParams)

Source from the content-addressed store, hash-verified

139 * This enables conversation branching without git worktree overhead.
140 */
141 async forkWorkspace(params: WorkspaceForkParams): Promise<WorkspaceForkResult> {
142 const { initLogger } = params;
143
144 initLogger.logStep("Creating conversation fork (no worktree isolation)");
145
146 // Verify the project directory exists (same check as createWorkspace)
147 try {
148 await this.stat(this.projectPath);
149 } catch {
150 return {
151 success: false,
152 error: `Project directory does not exist: ${this.projectPath}`,
153 };
154 }
155
156 initLogger.logStep("Project directory verified");
157
158 // Return success - the workspace service will copy chat history
159 // and create a new workspace entry pointing to this project directory
160 return {
161 success: true,
162 workspacePath: this.projectPath,
163 // sourceBranch is optional for LocalRuntime since no git operations are involved
164 };
165 }
166}

Callers

nothing calls this directly

Calls 2

logStepMethod · 0.80
statMethod · 0.65

Tested by

no test coverage detected