Forge
csharpdeeb25a2
1using CascadeIDE.Contracts;
2
3namespace CascadeIDE.Cockpit.ComputingUnits.IdeHealth;
4
5/// <summary>
6/// CCU «решение о scope» (ADR 0097): определяет, когда IDE Health сегменты должны быть project-scoped
7/// вместо solution-scoped на основе startup project и активного build/tests сигнала.
8/// </summary>
9[ComputingUnit]
10public sealed class IdeHealthScopeDecisionUnit : ICockpitComputeUnit
11{
12 /// <summary>Единственный экземпляр юнита (без состояния).</summary>
13 public static IdeHealthScopeDecisionUnit Default { get; } = new();
14
15 private IdeHealthScopeDecisionUnit()
16 {
17 }
18
19 public IdeHealthScopeDecision Decide(string? startupProjectPath, bool isBuilding, string? lastTestSummary)
20 {
21 var hasStartupProject = !string.IsNullOrWhiteSpace(startupProjectPath);
22 var hasProjectSignal = isBuilding || !string.IsNullOrWhiteSpace(lastTestSummary);
23 var hasProjectScope = hasStartupProject && hasProjectSignal;
24 return hasProjectScope
25 ? new IdeHealthScopeDecision(IdeHealthScope.Project, startupProjectPath!)
26 : new IdeHealthScopeDecision(IdeHealthScope.Solution, null);
27 }
28}
29
30public readonly record struct IdeHealthScopeDecision(IdeHealthScope Scope, string? ProjectPath);
31
View only · write via MCP/CIDE