MCPcopy Index your code
hub / github.com/coder/mux / initWorkspace

Method initWorkspace

src/node/runtime/SSHRuntime.ts:2501–2525  ·  view source on GitHub ↗
(params: WorkspaceInitParams)

Source from the content-addressed store, hash-verified

2499 }
2500
2501 async initWorkspace(params: WorkspaceInitParams): Promise<WorkspaceInitResult> {
2502 // Disable git hooks for untrusted projects (prevents post-checkout execution)
2503 const nhp = gitNoHooksPrefix(params.trusted);
2504
2505 return runWorkspaceInitHook({
2506 params,
2507 runtimeType: "ssh",
2508 hookCheckPath: params.projectPath,
2509 beforeHook: async () => {
2510 await this.prepareWorkspaceCheckout(params, nhp);
2511 },
2512 runHook: async ({ muxEnv, initLogger, abortSignal }) => {
2513 // Expand tilde in hook path (quoted paths don't auto-expand on remote).
2514 const hookPath = expandTildeForSSH(`${params.workspacePath}/.mux/init`);
2515 await runInitHookOnRuntime(
2516 this,
2517 hookPath,
2518 params.workspacePath,
2519 muxEnv,
2520 initLogger,
2521 abortSignal
2522 );
2523 },
2524 });
2525 }
2526
2527 /**
2528 * Try to create the workspace via a single fused SSH command (warm fast-path).

Callers

nothing calls this directly

Calls 5

gitNoHooksPrefixFunction · 0.90
runWorkspaceInitHookFunction · 0.90
expandTildeForSSHFunction · 0.90
runInitHookOnRuntimeFunction · 0.90

Tested by

no test coverage detected