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

Method initWorkspace

src/node/runtime/DockerRuntime.ts:525–550  ·  view source on GitHub ↗

* Initialize workspace by running .mux/init hook. * Assumes postCreateSetup() has already been called to provision/prepare the container. * * This method ONLY runs the hook - all container provisioning and credential setup * is handled by postCreateSetup().

(params: WorkspaceInitParams)

Source from the content-addressed store, hash-verified

523 * is handled by postCreateSetup().
524 */
525 async initWorkspace(params: WorkspaceInitParams): Promise<WorkspaceInitResult> {
526 if (!this.containerName) {
527 return {
528 success: false,
529 error: "Container not initialized. Call createWorkspace first.",
530 };
531 }
532
533 // Do NOT delete container on hook failure - user can debug.
534 return runWorkspaceInitHook({
535 params,
536 runtimeType: "docker",
537 hookCheckPath: params.projectPath,
538 runHook: async ({ muxEnv, initLogger, abortSignal }) => {
539 const hookPath = `${params.workspacePath}/.mux/init`;
540 await runInitHookOnRuntime(
541 this,
542 hookPath,
543 params.workspacePath,
544 muxEnv,
545 initLogger,
546 abortSignal
547 );
548 },
549 });
550 }
551
552 /**
553 * Check if a container already exists and whether it's valid for reuse.

Callers

nothing calls this directly

Calls 2

runWorkspaceInitHookFunction · 0.90
runInitHookOnRuntimeFunction · 0.90

Tested by

no test coverage detected