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

Method initWorkspace

src/node/runtime/multiProjectRuntime.ts:154–190  ·  view source on GitHub ↗
(params: WorkspaceInitParams)

Source from the content-addressed store, hash-verified

152 }
153
154 async initWorkspace(params: WorkspaceInitParams): Promise<WorkspaceInitResult> {
155 const projectInitLogger = {
156 ...params.initLogger,
157 // Individual runtimes report completion; suppress per-project completion so the
158 // multi-project workspace transitions out of initializing only after all runtimes finish.
159 logComplete: (_exitCode: number) => undefined,
160 };
161
162 const initResults: WorkspaceInitResult[] = [];
163
164 for (const projectRuntime of this.projectRuntimes) {
165 const projectWorkspacePath = projectRuntime.runtime.getWorkspacePath(
166 projectRuntime.projectPath,
167 params.branchName
168 );
169 const projectEnv = (await this.envResolver?.(projectRuntime.projectPath)) ?? params.env;
170
171 const initResult = await projectRuntime.runtime.initWorkspace({
172 ...params,
173 projectPath: projectRuntime.projectPath,
174 workspacePath: projectWorkspacePath,
175 initLogger: projectInitLogger,
176 env: projectEnv,
177 });
178
179 initResults.push(initResult);
180 }
181
182 const firstFailure = initResults.find((result) => !result.success);
183 if (firstFailure) {
184 params.initLogger.logComplete(-1);
185 return firstFailure;
186 }
187
188 params.initLogger.logComplete(0);
189 return { success: true };
190 }
191
192 async deleteWorkspace(
193 _projectPath: string,

Callers

nothing calls this directly

Calls 4

logCompleteMethod · 0.80
getWorkspacePathMethod · 0.65
initWorkspaceMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected