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

Method getExistingMaterializedTaskLaunch

src/node/services/taskService.ts:2558–2590  ·  view source on GitHub ↗
(
    plan: TaskLaunchPlan,
    sourceRuntime: Runtime,
    workspace: WorkspaceConfigEntry
  )

Source from the content-addressed store, hash-verified

2556 }
2557
2558 private async getExistingMaterializedTaskLaunch(
2559 plan: TaskLaunchPlan,
2560 sourceRuntime: Runtime,
2561 workspace: WorkspaceConfigEntry
2562 ): Promise<MaterializedTaskLaunch | null> {
2563 const workspacePath =
2564 coerceNonEmptyString(workspace.path) ??
2565 sourceRuntime.getWorkspacePath(plan.parentMeta.projectPath, plan.workspaceName);
2566 if (!(await runtimePathExists(sourceRuntime, workspacePath))) {
2567 return null;
2568 }
2569
2570 const forkedRuntimeConfig = workspace.runtimeConfig ?? plan.taskRuntimeConfig;
2571 const runtimeForTaskWorkspace = createRuntimeForWorkspace({
2572 runtimeConfig: forkedRuntimeConfig,
2573 projectPath: plan.parentMeta.projectPath,
2574 name: plan.workspaceName,
2575 namedWorkspacePath: workspacePath,
2576 });
2577 const trunkBranch =
2578 coerceNonEmptyString(workspace.taskTrunkBranch) ??
2579 coerceNonEmptyString(plan.preferredTrunkBranch) ??
2580 coerceNonEmptyString(plan.parentMeta.name) ??
2581 plan.workspaceName;
2582
2583 return {
2584 workspacePath,
2585 trunkBranch,
2586 forkedRuntimeConfig,
2587 runtimeForTaskWorkspace,
2588 inheritedProjects: workspace.projects ?? plan.parentMeta.projects,
2589 };
2590 }
2591
2592 private async runProjectForkExclusive<T>(projectPath: string, fn: () => Promise<T>): Promise<T> {
2593 assert(projectPath.length > 0, "runProjectForkExclusive requires projectPath");

Callers 1

Calls 4

coerceNonEmptyStringFunction · 0.90
runtimePathExistsFunction · 0.85
getWorkspacePathMethod · 0.65

Tested by

no test coverage detected