Standalone WPF app (ClaudeDo.Installer) that handles full installation and ongoing configuration of ClaudeDo. Two modes: wizard for first run, tabbed settings panel for subsequent launches. Page-based extensibility via IInstallerPage interface — adding new config sections requires only one new class. Install pipeline: dotnet publish, deploy binaries, write configs, init DB (via SchemaInitializer from ClaudeDo.Data), register Windows Service, create shortcuts. Dark theme matching the Avalonia app (forest teal accent). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
namespace ClaudeDo.Installer.Core;
|
|
|
|
public sealed class InstallerService
|
|
{
|
|
private readonly IEnumerable<IInstallStep> _steps;
|
|
|
|
public InstallerService(IEnumerable<IInstallStep> steps) => _steps = steps;
|
|
|
|
public async Task<IReadOnlyList<(IInstallStep Step, StepResult Result)>> ExecuteAsync(
|
|
InstallContext ctx,
|
|
IProgress<StepProgress> progress,
|
|
CancellationToken ct)
|
|
{
|
|
var results = new List<(IInstallStep, StepResult)>();
|
|
|
|
foreach (var step in _steps)
|
|
{
|
|
ct.ThrowIfCancellationRequested();
|
|
progress.Report(new StepProgress(step.Name, StepStatus.Running));
|
|
|
|
var lineProgress = new Progress<string>(msg =>
|
|
progress.Report(new StepProgress(step.Name, StepStatus.Running, msg)));
|
|
|
|
try
|
|
{
|
|
var result = await step.ExecuteAsync(ctx, lineProgress, ct);
|
|
var status = result.Success ? StepStatus.Done : StepStatus.Failed;
|
|
progress.Report(new StepProgress(step.Name, status, result.ErrorMessage));
|
|
results.Add((step, result));
|
|
|
|
if (!result.Success) break;
|
|
}
|
|
catch (OperationCanceledException)
|
|
{
|
|
progress.Report(new StepProgress(step.Name, StepStatus.Failed, "Cancelled"));
|
|
results.Add((step, StepResult.Fail("Cancelled")));
|
|
break;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
progress.Report(new StepProgress(step.Name, StepStatus.Failed, ex.Message));
|
|
results.Add((step, StepResult.Fail(ex.Message)));
|
|
break;
|
|
}
|
|
}
|
|
|
|
return results;
|
|
}
|
|
}
|