Merge branch 'main' into claudedo/4e19605838a3404f98624cb0e90195da
# Conflicts: # docs/open.md # src/ClaudeDo.Installer/CLAUDE.md # src/ClaudeDo.Installer/Pages/SystemCheckPage/SystemCheckPageView.xaml # src/ClaudeDo.Installer/Pages/SystemCheckPage/SystemCheckPageViewModel.cs
This commit is contained in:
@@ -11,6 +11,7 @@ using ClaudeDo.Installer.Core.Interfaces;
|
||||
using ClaudeDo.Installer.Localization;
|
||||
using ClaudeDo.Localization;
|
||||
using ClaudeDo.Releases;
|
||||
using ClaudeDo.Installer.Pages.DiagnosePage;
|
||||
using ClaudeDo.Installer.Pages.InstallPage;
|
||||
using ClaudeDo.Installer.Pages.PathsPage;
|
||||
using ClaudeDo.Installer.Pages.ServicePage;
|
||||
@@ -155,6 +156,10 @@ public partial class App : Application
|
||||
sc.AddSingleton<IInstallerPage, ServicePageViewModel>();
|
||||
sc.AddSingleton<IInstallerPage, UiSettingsPageViewModel>();
|
||||
sc.AddSingleton<IInstallerPage, InstallPageViewModel>();
|
||||
sc.AddSingleton<IInstallerPage>(sp => new DiagnosePageViewModel(
|
||||
sp.GetRequiredService<InstallContext>(),
|
||||
sp.GetRequiredService<Func<EnvironmentCheckService>>(),
|
||||
InstallerWorkerConfig.Load));
|
||||
|
||||
// Steps — execution order matters for the FreshInstall pipeline (IEnumerable<IInstallStep>).
|
||||
// Double-registered as both IInstallStep and concrete type so the Update pipeline
|
||||
|
||||
@@ -128,12 +128,6 @@ The Apps & Features uninstall string and "Rerun Installer" both point at `<Insta
|
||||
|
||||
## Environment Checks
|
||||
|
||||
> **Merge status (2026-08-06): `Checks/`, `SystemCheckPage`, `ExecutableResolver`, and the
|
||||
> "Claude Help Me" button below are on this branch.** The 2026-08-05 note about two unmerged
|
||||
> task branches applied to an earlier state; the "Claude Help Me" button follow-up has since
|
||||
> landed (see below). The Config-mode Diagnose section in `SettingsWindow` is still **not**
|
||||
> implemented — see `docs/open.md`.
|
||||
|
||||
`Checks/` holds one `IEnvironmentCheck` per concern, run in parallel by `EnvironmentCheckService.RunAllAsync`:
|
||||
|
||||
| Check | Severity | What it verifies |
|
||||
@@ -156,6 +150,10 @@ regardless of severity (an indeterminate result — e.g. the CLI not found, so v
|
||||
can't be checked — must not strand the user; the underlying `Error`-severity check for the CLI
|
||||
itself, `ClaudeCliCheck`, is what blocks in that case).
|
||||
|
||||
The check-row rendering and the check-run logic (busy state, summary text, Recheck command) live
|
||||
in one place — `Checks/CheckListViewModel.cs` + `Checks/CheckListView.xaml` — composed by every
|
||||
page that hosts a check list, not duplicated per page.
|
||||
|
||||
`SystemCheckPage` (`Pages/SystemCheckPage/`) hosts the check list in the **FreshInstall** wizard
|
||||
only, registered via `PageResolver` at `Order = 1` (directly after `WelcomePage`); `WizardViewModel`
|
||||
filters it back out in `Update` mode along with Paths/Service/UiSettings. Checks run automatically
|
||||
@@ -164,8 +162,8 @@ on page entry (`LoadAsync`, guarded against double-entry). "Next" is disabled vi
|
||||
subscribes to `PropertyChanged` on the current page so a live recheck can flip it back. A "Recheck"
|
||||
button re-runs `EnvironmentCheckService.RunAllAsync` (disabled while already running).
|
||||
|
||||
**"Claude Help Me" button** (`Core/ClaudeHelpLauncher.cs`) — a second footer button next to
|
||||
"Recheck", enabled only when `claude-cli` is `Ok` and `claude-auth` is not `Failed` (`Unknown`
|
||||
**"Claude Help Me" button** (`Core/ClaudeHelpLauncher.cs`) — a second button below the shared
|
||||
check-list footer, enabled only when `claude-cli` is `Ok` and `claude-auth` is not `Failed` (`Unknown`
|
||||
stays enabled — an indeterminate login state shouldn't block the one feature that could help
|
||||
diagnose it). `BuildReportAsync` renders all check results (Id/Severity/Status/Message table,
|
||||
plus the full `Detail` of any `Failed` check) and system info (OS, `dotnet --list-runtimes`,
|
||||
@@ -175,7 +173,15 @@ user) and deliberately excludes credentials/tokens/env-var dumps. `LaunchTermina
|
||||
`wt.exe -d %TEMP% cmd.exe /k <claude> <prompt>` (or `cmd.exe /k <claude> <prompt>` if `wt.exe`
|
||||
isn't resolvable) via the injectable `IProcessLauncher`, pointing the initial prompt at that
|
||||
report file. Errors from either step surface as `ClaudeHelpError` on the page, never an
|
||||
exception.
|
||||
exception. It reads the last report via `CheckListViewModel.LastReport`, so it re-evaluates on
|
||||
every check run.
|
||||
|
||||
**Not implemented:** a Diagnose section in `SettingsWindow` (Config mode) that re-runs the same
|
||||
checks against the installed configuration — still speced as a follow-up, no code yet.
|
||||
`DiagnosePage` (`Pages/DiagnosePage/`) hosts the same `CheckListView` in `SettingsWindow` (Config
|
||||
mode only, `ShowInSettings = true` / `ShowInWizard = false`, `Order = 5` — after UiSettings).
|
||||
Nothing here blocks navigation and checks do **not** auto-run on load — only on a "Recheck" click.
|
||||
Unlike the wizard, its `InstallContext` is built from the **installed** configuration
|
||||
(`InstallerWorkerConfig.Load()` for `ClaudeBin`/`SignalRPort`, the shared `InstallContext` for
|
||||
`InstallDirectory`/`ExternalMcpPort`), refreshed on every `LoadAsync()` — not the wizard-default
|
||||
`InstallContext` the DI container hands out, which is only populated once a page's `ApplyAsync`
|
||||
(i.e. Save) runs. `DiagnosePage` intentionally has **no** "Claude Help Me" button — that one is
|
||||
wizard-only.
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<UserControl x:Class="ClaudeDo.Installer.Checks.CheckListView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ClaudeDo.Installer.Checks"
|
||||
xmlns:loc="clr-namespace:ClaudeDo.Installer.Localization"
|
||||
d:DataContext="{d:DesignInstance local:CheckListViewModel}"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Check list -->
|
||||
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl ItemsSource="{Binding Rows}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type local:CheckRowViewModel}">
|
||||
<Border Margin="0,0,0,6" Padding="10,8"
|
||||
Background="{StaticResource IslandBgBrush}"
|
||||
BorderBrush="{StaticResource BorderSubtleBrush}"
|
||||
BorderThickness="1" CornerRadius="4">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Ellipse Grid.Column="0" Width="10" Height="10" Margin="0,0,10,0"
|
||||
VerticalAlignment="Top"
|
||||
Fill="{Binding StatusBrush}"/>
|
||||
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="{Binding Title}" FontSize="13" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="{Binding Message}" FontSize="12"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
TextWrapping="Wrap" Margin="0,2,0,0"/>
|
||||
|
||||
<TextBlock Text="{Binding Hint}" FontSize="11"
|
||||
Foreground="{StaticResource TextMutedBrush}"
|
||||
TextWrapping="Wrap" Margin="0,4,0,0"
|
||||
Visibility="{Binding Hint, Converter={StaticResource NullToCollapsedConverter}}"/>
|
||||
|
||||
<Button Content="{Binding HelpUrl}"
|
||||
HorizontalAlignment="Left" Margin="-16,4,0,0"
|
||||
Background="Transparent" BorderThickness="0"
|
||||
Foreground="{StaticResource AccentLightBrush}"
|
||||
Cursor="Hand"
|
||||
Command="{Binding DataContext.OpenHelpUrlCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding HelpUrl}"
|
||||
Visibility="{Binding HelpUrl, Converter={StaticResource NullToCollapsedConverter}}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Progress + summary -->
|
||||
<StackPanel Grid.Row="1" Margin="0,8,0,0">
|
||||
<ProgressBar IsIndeterminate="True" Margin="0,0,0,8"
|
||||
Visibility="{Binding IsRunning, Converter={StaticResource BoolToVisConverter}}"/>
|
||||
<TextBlock Text="{Binding Summary}" FontSize="12" TextWrapping="Wrap"
|
||||
Foreground="{StaticResource TextSecondaryBrush}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HasBlockingError}" Value="True">
|
||||
<Setter Property="Foreground" Value="{StaticResource ErrorBrush}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Footer -->
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0">
|
||||
<!-- Reserved space: a "Claude Help Me" button lands here in a follow-up task. -->
|
||||
<Button Content="{loc:Tr installer.systemCheck.recheck}"
|
||||
Command="{Binding RunChecksCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClaudeDo.Installer.Checks;
|
||||
|
||||
public partial class CheckListView : UserControl
|
||||
{
|
||||
public CheckListView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using ClaudeDo.Installer.Core;
|
||||
using ClaudeDo.Installer.Localization;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace ClaudeDo.Installer.Checks;
|
||||
|
||||
public sealed class CheckRowViewModel
|
||||
{
|
||||
public CheckRowViewModel(CheckResult result)
|
||||
{
|
||||
var loc = TrExtension.Localizer;
|
||||
Status = result.Status;
|
||||
Severity = result.Severity;
|
||||
Title = loc?[result.TitleKey] ?? result.TitleKey;
|
||||
Message = result.Message;
|
||||
Hint = result.HintKey is not null ? loc?[result.HintKey] ?? result.HintKey : null;
|
||||
HelpUrl = result.HelpUrl;
|
||||
StatusBrush = ResolveBrush(Status, Severity);
|
||||
}
|
||||
|
||||
public CheckStatus Status { get; }
|
||||
public CheckSeverity Severity { get; }
|
||||
public string Title { get; }
|
||||
public string Message { get; }
|
||||
public string? Hint { get; }
|
||||
public string? HelpUrl { get; }
|
||||
public Brush StatusBrush { get; }
|
||||
|
||||
private static Brush ResolveBrush(CheckStatus status, CheckSeverity severity)
|
||||
{
|
||||
var key = status switch
|
||||
{
|
||||
CheckStatus.Ok => "StatusGreenBrush",
|
||||
CheckStatus.Unknown => "StatusGrayBrush",
|
||||
CheckStatus.Failed when severity == CheckSeverity.Error => "StatusRedBrush",
|
||||
CheckStatus.Failed => "StatusOrangeBrush",
|
||||
_ => "StatusGrayBrush",
|
||||
};
|
||||
return Application.Current?.Resources[key] as Brush ?? Brushes.Gray;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shared presentation logic for the environment check list: running the check pass, tracking
|
||||
/// busy/summary state, and the row collection. Composed (not subclassed) by every page that
|
||||
/// hosts a check list — <see cref="Pages.SystemCheckPage.SystemCheckPageViewModel"/> and
|
||||
/// <see cref="Pages.DiagnosePage.DiagnosePageViewModel"/> — so the run logic exists exactly once.
|
||||
/// </summary>
|
||||
public partial class CheckListViewModel : ObservableObject
|
||||
{
|
||||
private readonly InstallContext _context;
|
||||
private readonly Func<EnvironmentCheckService> _checkServiceFactory;
|
||||
|
||||
public ObservableCollection<CheckRowViewModel> Rows { get; } = [];
|
||||
|
||||
/// <summary>Report of the most recent run, null before the first one. Hosts that need the raw
|
||||
/// results (the wizard's "Claude Help Me" button) read it instead of running the checks again.</summary>
|
||||
public EnvironmentCheckReport? LastReport { get; private set; }
|
||||
|
||||
[ObservableProperty] private bool _isRunning;
|
||||
[ObservableProperty] private bool _hasRun;
|
||||
[ObservableProperty] private bool _hasBlockingError;
|
||||
[ObservableProperty] private string _summary = string.Empty;
|
||||
|
||||
public CheckListViewModel(InstallContext context, Func<EnvironmentCheckService> checkServiceFactory)
|
||||
{
|
||||
_context = context;
|
||||
_checkServiceFactory = checkServiceFactory;
|
||||
}
|
||||
|
||||
partial void OnIsRunningChanged(bool value) => RunChecksCommand.NotifyCanExecuteChanged();
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanRunChecks))]
|
||||
private async Task RunChecksAsync()
|
||||
{
|
||||
if (IsRunning) return;
|
||||
|
||||
IsRunning = true;
|
||||
Summary = TrExtension.Localizer?["installer.systemCheck.summary.running"] ?? "Checking your system…";
|
||||
|
||||
try
|
||||
{
|
||||
var service = _checkServiceFactory();
|
||||
var report = await service.RunAllAsync(_context, CancellationToken.None);
|
||||
|
||||
Rows.Clear();
|
||||
foreach (var result in report.Results)
|
||||
Rows.Add(new CheckRowViewModel(result));
|
||||
|
||||
LastReport = report;
|
||||
OnPropertyChanged(nameof(LastReport));
|
||||
HasBlockingError = report.HasBlockingError;
|
||||
Summary = BuildSummary(report);
|
||||
HasRun = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanRunChecks() => !IsRunning;
|
||||
|
||||
private static string BuildSummary(EnvironmentCheckReport report)
|
||||
{
|
||||
var loc = TrExtension.Localizer;
|
||||
|
||||
var blocking = report.Results
|
||||
.Where(r => r.Severity == CheckSeverity.Error && r.Status == CheckStatus.Failed)
|
||||
.ToList();
|
||||
if (blocking.Count > 0)
|
||||
{
|
||||
var names = string.Join(", ", blocking.Select(r => loc?[r.TitleKey] ?? r.TitleKey));
|
||||
return loc?.Get("installer.systemCheck.summary.blocking", blocking.Count, names)
|
||||
?? $"{blocking.Count} problem(s) must be fixed: {names}";
|
||||
}
|
||||
|
||||
var warnings = report.Results.Count(r => r.Severity == CheckSeverity.Warning && r.Status == CheckStatus.Failed);
|
||||
if (warnings > 0)
|
||||
{
|
||||
return loc?.Get("installer.systemCheck.summary.warnings", warnings)
|
||||
?? $"{warnings} warning(s) found.";
|
||||
}
|
||||
|
||||
return loc?["installer.systemCheck.summary.ok"] ?? "Everything looks good.";
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private static void OpenHelpUrl(string? url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url)) return;
|
||||
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<UserControl x:Class="ClaudeDo.Installer.Pages.DiagnosePage.DiagnosePageView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ClaudeDo.Installer.Pages.DiagnosePage"
|
||||
xmlns:checks="clr-namespace:ClaudeDo.Installer.Checks"
|
||||
xmlns:loc="clr-namespace:ClaudeDo.Installer.Localization"
|
||||
d:DataContext="{d:DesignInstance local:DiagnosePageViewModel}"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<StackPanel Grid.Row="0" Margin="0,0,0,16">
|
||||
<TextBlock Text="{loc:Tr installer.diagnose.title}" FontSize="18" FontWeight="SemiBold" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="{loc:Tr installer.diagnose.subtitle}"
|
||||
Foreground="{StaticResource TextSecondaryBrush}" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<checks:CheckListView Grid.Row="1" DataContext="{Binding Checks}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.DiagnosePage;
|
||||
|
||||
public partial class DiagnosePageView : UserControl
|
||||
{
|
||||
public DiagnosePageView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
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;
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ClaudeDo.Installer.Pages.SystemCheckPage"
|
||||
xmlns:checks="clr-namespace:ClaudeDo.Installer.Checks"
|
||||
xmlns:loc="clr-namespace:ClaudeDo.Installer.Localization"
|
||||
d:DataContext="{d:DesignInstance local:SystemCheckPageViewModel}"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
@@ -13,7 +14,6 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
@@ -23,85 +23,17 @@
|
||||
Foreground="{StaticResource TextSecondaryBrush}" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Check list -->
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl ItemsSource="{Binding Rows}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type local:CheckRowViewModel}">
|
||||
<Border Margin="0,0,0,6" Padding="10,8"
|
||||
Background="{StaticResource IslandBgBrush}"
|
||||
BorderBrush="{StaticResource BorderSubtleBrush}"
|
||||
BorderThickness="1" CornerRadius="4">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<checks:CheckListView Grid.Row="1" DataContext="{Binding Checks}"/>
|
||||
|
||||
<Ellipse Grid.Column="0" Width="10" Height="10" Margin="0,0,10,0"
|
||||
VerticalAlignment="Top"
|
||||
Fill="{Binding StatusBrush}"/>
|
||||
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="{Binding Title}" FontSize="13" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="{Binding Message}" FontSize="12"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
TextWrapping="Wrap" Margin="0,2,0,0"/>
|
||||
|
||||
<TextBlock Text="{Binding Hint}" FontSize="11"
|
||||
Foreground="{StaticResource TextMutedBrush}"
|
||||
TextWrapping="Wrap" Margin="0,4,0,0"
|
||||
Visibility="{Binding Hint, Converter={StaticResource NullToCollapsedConverter}}"/>
|
||||
|
||||
<Button Content="{Binding HelpUrl}"
|
||||
HorizontalAlignment="Left" Margin="-16,4,0,0"
|
||||
Background="Transparent" BorderThickness="0"
|
||||
Foreground="{StaticResource AccentLightBrush}"
|
||||
Cursor="Hand"
|
||||
Command="{Binding DataContext.OpenHelpUrlCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding HelpUrl}"
|
||||
Visibility="{Binding HelpUrl, Converter={StaticResource NullToCollapsedConverter}}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Progress + summary -->
|
||||
<!-- Wizard-only footer: "Claude Help Me" (the Recheck button lives in the shared list) -->
|
||||
<StackPanel Grid.Row="2" Margin="0,8,0,0">
|
||||
<ProgressBar IsIndeterminate="True" Margin="0,0,0,8"
|
||||
Visibility="{Binding IsRunning, Converter={StaticResource BoolToVisConverter}}"/>
|
||||
<TextBlock Text="{Binding Summary}" FontSize="12" TextWrapping="Wrap"
|
||||
Foreground="{StaticResource TextSecondaryBrush}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HasBlockingError}" Value="True">
|
||||
<Setter Property="Foreground" Value="{StaticResource ErrorBrush}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Footer -->
|
||||
<StackPanel Grid.Row="3" Margin="0,12,0,0">
|
||||
<TextBlock Text="{Binding ClaudeHelpError}" FontSize="12" TextWrapping="Wrap"
|
||||
Foreground="{StaticResource ErrorBrush}" Margin="0,0,0,8"
|
||||
Visibility="{Binding ClaudeHelpError, Converter={StaticResource NullToCollapsedConverter}}"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="{loc:Tr installer.systemCheck.claudeHelp.button}"
|
||||
ToolTip="{Binding ClaudeHelpTooltip}"
|
||||
Command="{Binding StartClaudeHelpCommand}"
|
||||
Margin="0,0,8,0"/>
|
||||
<Button Content="{loc:Tr installer.systemCheck.recheck}"
|
||||
Command="{Binding RunChecksCommand}"/>
|
||||
</StackPanel>
|
||||
<Button Content="{loc:Tr installer.systemCheck.claudeHelp.button}"
|
||||
HorizontalAlignment="Right"
|
||||
ToolTip="{Binding ClaudeHelpTooltip}"
|
||||
Command="{Binding StartClaudeHelpCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using ClaudeDo.Installer.Checks;
|
||||
using ClaudeDo.Installer.Core;
|
||||
using ClaudeDo.Installer.Localization;
|
||||
@@ -11,73 +8,40 @@ using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.SystemCheckPage;
|
||||
|
||||
public sealed class CheckRowViewModel
|
||||
{
|
||||
public CheckRowViewModel(CheckResult result)
|
||||
{
|
||||
var loc = TrExtension.Localizer;
|
||||
Status = result.Status;
|
||||
Severity = result.Severity;
|
||||
Title = loc?[result.TitleKey] ?? result.TitleKey;
|
||||
Message = result.Message;
|
||||
Hint = result.HintKey is not null ? loc?[result.HintKey] ?? result.HintKey : null;
|
||||
HelpUrl = result.HelpUrl;
|
||||
StatusBrush = ResolveBrush(Status, Severity);
|
||||
}
|
||||
|
||||
public CheckStatus Status { get; }
|
||||
public CheckSeverity Severity { get; }
|
||||
public string Title { get; }
|
||||
public string Message { get; }
|
||||
public string? Hint { get; }
|
||||
public string? HelpUrl { get; }
|
||||
public Brush StatusBrush { get; }
|
||||
|
||||
private static Brush ResolveBrush(CheckStatus status, CheckSeverity severity)
|
||||
{
|
||||
var key = status switch
|
||||
{
|
||||
CheckStatus.Ok => "StatusGreenBrush",
|
||||
CheckStatus.Unknown => "StatusGrayBrush",
|
||||
CheckStatus.Failed when severity == CheckSeverity.Error => "StatusRedBrush",
|
||||
CheckStatus.Failed => "StatusOrangeBrush",
|
||||
_ => "StatusGrayBrush",
|
||||
};
|
||||
return Application.Current?.Resources[key] as Brush ?? Brushes.Gray;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class SystemCheckPageViewModel : ObservableObject, IInstallerPage
|
||||
{
|
||||
private readonly InstallContext _context;
|
||||
private readonly Func<EnvironmentCheckService> _checkServiceFactory;
|
||||
private readonly ClaudeHelpLauncher _claudeHelpLauncher;
|
||||
private SystemCheckPageView? _view;
|
||||
private bool _hasStarted;
|
||||
private EnvironmentCheckReport? _lastReport;
|
||||
|
||||
public string Title => TrExtension.Localizer?["installer.systemCheck.title"] ?? "System Check";
|
||||
public string Icon => "";
|
||||
public string Icon => "";
|
||||
public int Order => 1;
|
||||
public bool ShowInWizard => true;
|
||||
public bool ShowInSettings => false;
|
||||
public UserControl View => _view ??= new SystemCheckPageView { DataContext = this };
|
||||
|
||||
public ObservableCollection<CheckRowViewModel> Rows { get; } = [];
|
||||
public CheckListViewModel Checks { get; }
|
||||
|
||||
// Pass-through to the shared check-run logic — kept so this page's UI/tests can bind
|
||||
// directly on it, matching the pre-extraction API.
|
||||
public ObservableCollection<CheckRowViewModel> Rows => Checks.Rows;
|
||||
public bool IsRunning => Checks.IsRunning;
|
||||
public bool HasRun => Checks.HasRun;
|
||||
public bool HasBlockingError => Checks.HasBlockingError;
|
||||
public string Summary => Checks.Summary;
|
||||
public IAsyncRelayCommand RunChecksCommand => Checks.RunChecksCommand;
|
||||
|
||||
public bool BlocksNavigation => Checks.IsRunning || Checks.HasBlockingError;
|
||||
|
||||
[ObservableProperty] private bool _isRunning;
|
||||
[ObservableProperty] private bool _hasRun;
|
||||
[ObservableProperty] private bool _hasBlockingError;
|
||||
[ObservableProperty] private string _summary = string.Empty;
|
||||
[ObservableProperty] private string? _claudeHelpError;
|
||||
|
||||
public bool BlocksNavigation => IsRunning || HasBlockingError;
|
||||
|
||||
public bool ClaudeCliOk =>
|
||||
_lastReport?.Results.FirstOrDefault(r => r.Id == ClaudeCliCheck.CheckId)?.Status == CheckStatus.Ok;
|
||||
Checks.LastReport?.Results.FirstOrDefault(r => r.Id == ClaudeCliCheck.CheckId)?.Status == CheckStatus.Ok;
|
||||
|
||||
public bool ClaudeAuthFailed =>
|
||||
_lastReport?.Results.FirstOrDefault(r => r.Id == ClaudeAuthCheck.CheckId)?.Status == CheckStatus.Failed;
|
||||
Checks.LastReport?.Results.FirstOrDefault(r => r.Id == ClaudeAuthCheck.CheckId)?.Status == CheckStatus.Failed;
|
||||
|
||||
public bool CanStartClaudeHelp => ClaudeCliOk && !ClaudeAuthFailed;
|
||||
|
||||
@@ -101,24 +65,28 @@ public partial class SystemCheckPageViewModel : ObservableObject, IInstallerPage
|
||||
ClaudeHelpLauncher claudeHelpLauncher)
|
||||
{
|
||||
_context = context;
|
||||
_checkServiceFactory = checkServiceFactory;
|
||||
_claudeHelpLauncher = claudeHelpLauncher;
|
||||
Checks = new CheckListViewModel(context, checkServiceFactory);
|
||||
// The wizard listens for PropertyChanged on this page to re-evaluate "Next" — bubble
|
||||
// any change from the composed check list up so a live recheck can flip it back, and so
|
||||
// the Claude-Help gating re-reads the fresh report.
|
||||
Checks.PropertyChanged += (_, _) =>
|
||||
{
|
||||
OnPropertyChanged(nameof(BlocksNavigation));
|
||||
OnPropertyChanged(nameof(ClaudeCliOk));
|
||||
OnPropertyChanged(nameof(ClaudeAuthFailed));
|
||||
OnPropertyChanged(nameof(CanStartClaudeHelp));
|
||||
OnPropertyChanged(nameof(ClaudeHelpTooltip));
|
||||
StartClaudeHelpCommand.NotifyCanExecuteChanged();
|
||||
};
|
||||
}
|
||||
|
||||
partial void OnIsRunningChanged(bool value)
|
||||
{
|
||||
OnPropertyChanged(nameof(BlocksNavigation));
|
||||
RunChecksCommand.NotifyCanExecuteChanged();
|
||||
}
|
||||
|
||||
partial void OnHasBlockingErrorChanged(bool value) => OnPropertyChanged(nameof(BlocksNavigation));
|
||||
|
||||
public Task LoadAsync()
|
||||
{
|
||||
if (!_hasStarted)
|
||||
{
|
||||
_hasStarted = true;
|
||||
_ = RunChecksAsync();
|
||||
_ = Checks.RunChecksCommand.ExecuteAsync(null);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
@@ -127,82 +95,17 @@ public partial class SystemCheckPageViewModel : ObservableObject, IInstallerPage
|
||||
|
||||
public bool Validate() => !HasBlockingError;
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanRunChecks))]
|
||||
private async Task RunChecksAsync()
|
||||
{
|
||||
if (IsRunning) return;
|
||||
|
||||
IsRunning = true;
|
||||
Summary = TrExtension.Localizer?["installer.systemCheck.summary.running"] ?? "Checking your system…";
|
||||
|
||||
try
|
||||
{
|
||||
var service = _checkServiceFactory();
|
||||
var report = await service.RunAllAsync(_context, CancellationToken.None);
|
||||
|
||||
Rows.Clear();
|
||||
foreach (var result in report.Results)
|
||||
Rows.Add(new CheckRowViewModel(result));
|
||||
|
||||
_lastReport = report;
|
||||
HasBlockingError = report.HasBlockingError;
|
||||
Summary = BuildSummary(report);
|
||||
HasRun = true;
|
||||
|
||||
OnPropertyChanged(nameof(CanStartClaudeHelp));
|
||||
OnPropertyChanged(nameof(ClaudeHelpTooltip));
|
||||
StartClaudeHelpCommand.NotifyCanExecuteChanged();
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanRunChecks() => !IsRunning;
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanStartClaudeHelp))]
|
||||
private async Task StartClaudeHelpAsync()
|
||||
{
|
||||
if (_lastReport is null) return;
|
||||
if (Checks.LastReport is null) return;
|
||||
|
||||
ClaudeHelpError = null;
|
||||
var result = await _claudeHelpLauncher.LaunchAsync(_lastReport, _context, CancellationToken.None);
|
||||
var result = await _claudeHelpLauncher.LaunchAsync(Checks.LastReport, _context, CancellationToken.None);
|
||||
if (!result.Success)
|
||||
{
|
||||
ClaudeHelpError = TrExtension.Localizer?.Get("installer.systemCheck.claudeHelp.error", result.ErrorMessage ?? "")
|
||||
?? $"Could not start the Claude session: {result.ErrorMessage}";
|
||||
}
|
||||
}
|
||||
|
||||
private static string BuildSummary(EnvironmentCheckReport report)
|
||||
{
|
||||
var loc = TrExtension.Localizer;
|
||||
|
||||
var blocking = report.Results
|
||||
.Where(r => r.Severity == CheckSeverity.Error && r.Status == CheckStatus.Failed)
|
||||
.ToList();
|
||||
if (blocking.Count > 0)
|
||||
{
|
||||
var names = string.Join(", ", blocking.Select(r => loc?[r.TitleKey] ?? r.TitleKey));
|
||||
return loc?.Get("installer.systemCheck.summary.blocking", blocking.Count, names)
|
||||
?? $"{blocking.Count} problem(s) must be fixed: {names}";
|
||||
}
|
||||
|
||||
var warnings = report.Results.Count(r => r.Severity == CheckSeverity.Warning && r.Status == CheckStatus.Failed);
|
||||
if (warnings > 0)
|
||||
{
|
||||
return loc?.Get("installer.systemCheck.summary.warnings", warnings)
|
||||
?? $"{warnings} warning(s) found.";
|
||||
}
|
||||
|
||||
return loc?["installer.systemCheck.summary.ok"] ?? "Everything looks good.";
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private static void OpenHelpUrl(string? url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url)) return;
|
||||
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,6 +540,10 @@
|
||||
"subtitle": "Klicke auf Installieren, um ClaudeDo zu erstellen und bereitzustellen.",
|
||||
"launch": "ClaudeDo starten"
|
||||
},
|
||||
"diagnose": {
|
||||
"title": "Diagnose",
|
||||
"subtitle": "Führt die Systemprüfungen erneut aus, gegen deine installierte Konfiguration."
|
||||
},
|
||||
"settings": {
|
||||
"removeUserData": "Benutzerdaten entfernen (Aufgaben, Logs, Konfigurationen in ~/.todo-app)",
|
||||
"uninstall": "Deinstallieren",
|
||||
|
||||
@@ -540,6 +540,10 @@
|
||||
"subtitle": "Click Install to build and deploy ClaudeDo.",
|
||||
"launch": "Launch ClaudeDo"
|
||||
},
|
||||
"diagnose": {
|
||||
"title": "Diagnose",
|
||||
"subtitle": "Re-run the environment checks against your installed configuration."
|
||||
},
|
||||
"settings": {
|
||||
"removeUserData": "Remove user data (tasks, logs, configs in ~/.todo-app)",
|
||||
"uninstall": "Uninstall",
|
||||
|
||||
Reference in New Issue
Block a user