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

Method deleteWorkspace

src/node/runtime/multiProjectRuntime.ts:192–238  ·  view source on GitHub ↗
(
    _projectPath: string,
    workspaceName: string,
    force: boolean,
    abortSignal?: AbortSignal,
    trusted?: boolean
  )

Source from the content-addressed store, hash-verified

190 }
191
192 async deleteWorkspace(
193 _projectPath: string,
194 workspaceName: string,
195 force: boolean,
196 abortSignal?: AbortSignal,
197 trusted?: boolean
198 ): Promise<{ success: true; deletedPath: string } | { success: false; error: string }> {
199 const errors: string[] = [];
200
201 for (const projectRuntime of this.projectRuntimes) {
202 try {
203 const deleteResult = await projectRuntime.runtime.deleteWorkspace(
204 projectRuntime.projectPath,
205 workspaceName,
206 force,
207 abortSignal,
208 trusted
209 );
210
211 if (!deleteResult.success) {
212 errors.push(
213 `[${projectRuntime.projectName}] ${deleteResult.error ?? "Unknown delete error"}`
214 );
215 }
216 } catch (error) {
217 errors.push(`[${projectRuntime.projectName}] ${getErrorMessage(error)}`);
218 }
219 }
220
221 try {
222 await this.containerManager.removeContainer(workspaceName);
223 } catch (error) {
224 errors.push(`[container] ${getErrorMessage(error)}`);
225 }
226
227 if (errors.length > 0) {
228 return {
229 success: false,
230 error: `Failed to delete multi-project workspace: ${errors.join("; ")}`,
231 };
232 }
233
234 return {
235 success: true,
236 deletedPath: this.containerManager.getContainerPath(workspaceName),
237 };
238 }
239
240 async forkWorkspace(params: WorkspaceForkParams): Promise<WorkspaceForkResult> {
241 const forkedRuntimes: MultiProjectRuntimeEntry[] = [];

Callers

nothing calls this directly

Calls 5

getErrorMessageFunction · 0.90
removeContainerMethod · 0.80
getContainerPathMethod · 0.80
deleteWorkspaceMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected