Files
ClaudeDo/src/ClaudeDo.Installer/Pages/DiagnosePage/DiagnosePageViewModel.cs
T
mika kuns 7e1b1177de feat(installer): add Diagnose section to SettingsWindow
Re-runs the environment checks against the installed configuration
(worker.config.json + detected install dir) without blocking navigation
and without auto-running on window open, only on a "Recheck" click.

Extracted the check-row rendering and check-run logic (busy state,
summary, Recheck command) out of SystemCheckPage into a shared
Checks/CheckListViewModel + Checks/CheckListView, composed by both
SystemCheckPage (wizard) and the new DiagnosePage (settings) instead
of duplicating it.
2026-08-06 08:22:45 +02:00

51 lines
1.9 KiB
C#

using System.Windows.Controls;
using ClaudeDo.Installer.Checks;
using ClaudeDo.Installer.Core;
using ClaudeDo.Installer.Localization;
using CommunityToolkit.Mvvm.ComponentModel;
namespace ClaudeDo.Installer.Pages.DiagnosePage;
/// <summary>
/// Re-runs the same environment checks as the wizard's SystemCheckPage, but against the
/// installed configuration (worker.config.json + the detected install directory) instead of
/// wizard defaults, and nothing here blocks navigation or auto-runs on load.
/// </summary>
public partial class DiagnosePageViewModel : ObservableObject, IInstallerPage
{
private readonly InstallContext _sharedContext;
private readonly Func<InstallerWorkerConfig> _loadWorkerConfig;
private readonly InstallContext _installedContext = new();
private DiagnosePageView? _view;
public string Title => TrExtension.Localizer?["installer.diagnose.title"] ?? "Diagnose";
public string Icon => "";
public int Order => 5;
public bool ShowInWizard => false;
public bool ShowInSettings => true;
public UserControl View => _view ??= new DiagnosePageView { DataContext = this };
public CheckListViewModel Checks { get; }
public DiagnosePageViewModel(InstallContext sharedContext, Func<EnvironmentCheckService> checkServiceFactory, Func<InstallerWorkerConfig> loadWorkerConfig)
{
_sharedContext = sharedContext;
_loadWorkerConfig = loadWorkerConfig;
Checks = new CheckListViewModel(_installedContext, checkServiceFactory);
}
public Task LoadAsync()
{
var cfg = _loadWorkerConfig();
_installedContext.InstallDirectory = _sharedContext.InstallDirectory;
_installedContext.ClaudeBin = cfg.ClaudeBin;
_installedContext.SignalRPort = cfg.SignalRPort;
_installedContext.ExternalMcpPort = _sharedContext.ExternalMcpPort;
return Task.CompletedTask;
}
public Task ApplyAsync() => Task.CompletedTask;
public bool Validate() => true;
}