Scaffolding for environment checks: IEnvironmentCheck, CheckResult/ CheckSeverity/CheckStatus, and EnvironmentCheckService that runs checks in parallel while preserving input order, never throws (a failing check becomes Unknown), and reports HasBlockingError only for Error+Failed.
26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
namespace ClaudeDo.Installer.Checks;
|
|
|
|
public enum CheckSeverity { Warning, Error }
|
|
|
|
public enum CheckStatus { Ok, Failed, Unknown }
|
|
|
|
public sealed record CheckResult(
|
|
string Id,
|
|
CheckSeverity Severity,
|
|
CheckStatus Status,
|
|
string TitleKey,
|
|
string Message,
|
|
string? HintKey,
|
|
string? HelpUrl,
|
|
string? Detail)
|
|
{
|
|
public static CheckResult Ok(string id, CheckSeverity severity, string titleKey, string message, string? detail = null) =>
|
|
new(id, severity, CheckStatus.Ok, titleKey, message, HintKey: null, HelpUrl: null, detail);
|
|
|
|
public static CheckResult Fail(string id, CheckSeverity severity, string titleKey, string message, string? hintKey = null, string? helpUrl = null, string? detail = null) =>
|
|
new(id, severity, CheckStatus.Failed, titleKey, message, hintKey, helpUrl, detail);
|
|
|
|
public static CheckResult Unknown(string id, CheckSeverity severity, string titleKey, string message, string? detail = null) =>
|
|
new(id, severity, CheckStatus.Unknown, titleKey, message, HintKey: null, HelpUrl: null, detail);
|
|
}
|