feat(installer): pull in preflight check implementations as prerequisite for SystemCheckPage
Git/GitIdentity/Port/WriteAccess and Claude CLI/Version/Auth/PermissionModeAuto checks plus the ExecutableResolver they depend on were built in two sibling task branches that hadn't landed on main yet. Vendored the finished files in from those branches (same content, verified building + tests green) so the SystemCheckPage task has something to consume.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using ClaudeDo.Installer.Core;
|
||||
|
||||
namespace ClaudeDo.Installer.Checks;
|
||||
|
||||
public sealed record EnvironmentCheckReport(IReadOnlyList<CheckResult> Results)
|
||||
{
|
||||
public bool HasBlockingError => Results.Any(r => r.Severity == CheckSeverity.Error && r.Status == CheckStatus.Failed);
|
||||
}
|
||||
|
||||
public sealed class EnvironmentCheckService
|
||||
{
|
||||
private readonly IReadOnlyList<IEnvironmentCheck> _checks;
|
||||
|
||||
public EnvironmentCheckService(IEnumerable<IEnvironmentCheck> checks)
|
||||
{
|
||||
_checks = checks.ToList();
|
||||
}
|
||||
|
||||
public async Task<EnvironmentCheckReport> RunAllAsync(InstallContext ctx, CancellationToken ct)
|
||||
{
|
||||
var tasks = _checks.Select(check => RunSafeAsync(check, ctx, ct)).ToArray();
|
||||
var results = await Task.WhenAll(tasks);
|
||||
return new EnvironmentCheckReport(results);
|
||||
}
|
||||
|
||||
private static async Task<CheckResult> RunSafeAsync(IEnvironmentCheck check, InstallContext ctx, CancellationToken ct)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await check.RunAsync(ctx, ct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CheckResult.Unknown(check.Id, check.Severity, string.Empty, ex.Message, ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user