(projectPath: string)
| 3433 | initLogger = this.createInitLogger(workspaceId); |
| 3434 | |
| 3435 | const resolveProjectTrunkBranch = async (projectPath: string): Promise<string> => { |
| 3436 | if (isLocalRuntime) { |
| 3437 | return normalizedPreferredTrunkBranch ?? ""; |
| 3438 | } |
| 3439 | |
| 3440 | if (!normalizedPreferredTrunkBranch) { |
| 3441 | const localBranches = await listLocalBranches(projectPath); |
| 3442 | return detectDefaultTrunkBranch(projectPath, localBranches); |
| 3443 | } |
| 3444 | |
| 3445 | try { |
| 3446 | const localBranches = await listLocalBranches(projectPath); |
| 3447 | if (localBranches.includes(normalizedPreferredTrunkBranch)) { |
| 3448 | return normalizedPreferredTrunkBranch; |
| 3449 | } |
| 3450 | |
| 3451 | const detectedTrunkBranch = await detectDefaultTrunkBranch(projectPath, localBranches); |
| 3452 | log.debug("Requested multi-project trunk branch missing; using detected branch", { |
| 3453 | projectPath, |
| 3454 | requestedTrunkBranch: normalizedPreferredTrunkBranch, |
| 3455 | detectedTrunkBranch, |
| 3456 | }); |
| 3457 | return detectedTrunkBranch; |
| 3458 | } catch (error: unknown) { |
| 3459 | // When branch discovery is unavailable, preserve the caller-provided branch. |
| 3460 | // This mirrors single-project create() behavior for non-local runtimes. |
| 3461 | log.debug("Failed to detect per-project trunk branch; using requested branch", { |
| 3462 | projectPath, |
| 3463 | requestedTrunkBranch: normalizedPreferredTrunkBranch, |
| 3464 | error: getErrorMessage(error), |
| 3465 | }); |
| 3466 | return normalizedPreferredTrunkBranch; |
| 3467 | } |
| 3468 | }; |
| 3469 | const projectRuntimeEntries = normalizedProjects.map((project) => ({ |
| 3470 | project, |
| 3471 | runtime: createRuntime(finalRuntimeConfig, { |
nothing calls this directly
no test coverage detected