Forge
csharpdeeb25a2
1#nullable enable
2
3using CascadeIDE.Contracts;
4
5namespace CascadeIDE.Cockpit.ComputingUnits.Launch;
6
7/// <summary>
8/// Мини-пайплайн pre-resolve для запуска: profile->project resolve + readiness + (опционально) MCP error message.
9/// </summary>
10[ComputingUnit]
11public sealed class LaunchPreResolvePipelineUnit : ICockpitComputeUnit
12{
13 private readonly LaunchProfileProjectResolveUnit _profileResolve = LaunchProfileProjectResolveUnit.Default;
14 private readonly LaunchReadinessUnit _readiness = LaunchReadinessUnit.Default;
15 private readonly LaunchMcpErrorFormatUnit _mcpError = LaunchMcpErrorFormatUnit.Default;
16
17 public static LaunchPreResolvePipelineUnit Default { get; } = new();
18
19 private LaunchPreResolvePipelineUnit()
20 {
21 }
22
23 public LaunchPreResolvePipelineSnapshot Compose(
24 string solutionPath,
25 string? explicitProfileName,
26 string solutionDirectory,
27 string? startupProjectFullPath)
28 {
29 var profileResolve = _profileResolve.Compose(solutionPath, explicitProfileName, solutionDirectory);
30 var readiness = _readiness.Compose(
31 hasSolutionPath: !string.IsNullOrWhiteSpace(solutionPath),
32 hasWorkspaceRoot: !string.IsNullOrWhiteSpace(solutionDirectory),
33 profileId: profileResolve.Profile?.ProfileId,
34 profileProjectRelative: profileResolve.Profile?.ProjectRelativeToSolution,
35 profileProjectFullPath: profileResolve.ProjectCsprojFullPath,
36 startupProjectFullPath: startupProjectFullPath);
37
38 return new LaunchPreResolvePipelineSnapshot(
39 profileResolve.Profile,
40 profileResolve.ProjectCsprojFullPath,
41 readiness,
42 readiness.CanAttemptResolve
43 ? null
44 : _mcpError.FormatResolveFailure(readiness, explicitProfileName, solutionDirectory));
45 }
46}
47
48public readonly record struct LaunchPreResolvePipelineSnapshot(
49 LaunchProfileData? Profile,
50 string? ProfileProjectCsprojFullPath,
51 LaunchReadinessSnapshot Readiness,
52 string? McpResolveError) : ICockpitComputeUnitPayload;
53
View only · write via MCP/CIDE