88 lines
2.0 KiB
C#
88 lines
2.0 KiB
C#
using Sdt.Config;
|
|
using Sdt.Runner;
|
|
|
|
namespace Sdt.Core;
|
|
|
|
public sealed record ProbeResult(
|
|
string Tool,
|
|
bool IsAvailable,
|
|
string? Version = null,
|
|
string? Details = null);
|
|
|
|
public sealed record InstallCommand(
|
|
string Command,
|
|
IReadOnlyList<string> Args);
|
|
|
|
public sealed record InstallPlan(
|
|
string Tool,
|
|
bool Supported,
|
|
string Summary,
|
|
IReadOnlyList<InstallCommand> Commands);
|
|
|
|
public sealed record WorkflowStepResult(
|
|
string WorkflowId,
|
|
string StepId,
|
|
string StepLabel,
|
|
RunResult Result);
|
|
|
|
public enum ExecutionStopReason
|
|
{
|
|
MissingPrereq,
|
|
InstallFailed,
|
|
CommandFailed,
|
|
ValidationFailed,
|
|
UserDeclined,
|
|
}
|
|
|
|
public sealed record WorkflowExecutionResult(
|
|
bool Success,
|
|
ExecutionStopReason? StopReason,
|
|
string Message,
|
|
IReadOnlyList<WorkflowStepResult> Steps);
|
|
|
|
public interface IToolProbe
|
|
{
|
|
Task<ProbeResult> ProbeAsync(
|
|
string tool,
|
|
string projectRoot,
|
|
DevToolConfig? config = null,
|
|
CancellationToken cancellationToken = default);
|
|
}
|
|
|
|
public interface IPrereqInstaller
|
|
{
|
|
Task<InstallPlan> GetInstallPlanAsync(
|
|
string tool,
|
|
string projectRoot,
|
|
DevToolConfig? config = null,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
Task<RunResult> RunInstallAsync(
|
|
InstallCommand command,
|
|
string projectRoot,
|
|
Action<string, bool> onOutput,
|
|
CancellationToken cancellationToken = default);
|
|
}
|
|
|
|
public interface IActionRunner
|
|
{
|
|
Task<RunResult> RunStepAsync(
|
|
WorkflowStep step,
|
|
string projectRoot,
|
|
Action<string, bool> onOutput,
|
|
CancellationToken cancellationToken = default);
|
|
}
|
|
|
|
public interface IWorkflowPlanner
|
|
{
|
|
List<WorkflowDefinition> ResolvePlan(
|
|
WorkflowDefinition workflow,
|
|
IReadOnlyDictionary<string, WorkflowDefinition> allWorkflows);
|
|
}
|
|
|
|
public interface IRequirementResolver
|
|
{
|
|
List<ToolRequirement> Resolve(WorkflowStep step);
|
|
List<ToolRequirement> Resolve(BuildTarget target);
|
|
}
|