feat(installer): add WPF installer/configurator project
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>
This commit is contained in:
101
src/ClaudeDo.Installer/Pages/InstallPage/InstallPageView.xaml
Normal file
101
src/ClaudeDo.Installer/Pages/InstallPage/InstallPageView.xaml
Normal file
@@ -0,0 +1,101 @@
|
||||
<UserControl x:Class="ClaudeDo.Installer.Pages.InstallPage.InstallPageView"
|
||||
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.InstallPage"
|
||||
d:DataContext="{d:DesignInstance local:InstallPageViewModel}"
|
||||
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="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<StackPanel Grid.Row="0" Margin="0,0,0,16">
|
||||
<TextBlock Text="Installation" FontSize="18" FontWeight="SemiBold" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Click Install to build and deploy ClaudeDo."
|
||||
Foreground="{StaticResource TextSecondaryBrush}" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Step List -->
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl ItemsSource="{Binding Steps}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type local:StepViewModel}">
|
||||
<Border Margin="0,0,0,6" Padding="10,8"
|
||||
Background="{StaticResource IslandBgBrush}"
|
||||
BorderBrush="{StaticResource BorderSubtleBrush}"
|
||||
BorderThickness="1" CornerRadius="4">
|
||||
<StackPanel>
|
||||
<!-- Step header -->
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Status indicator -->
|
||||
<Ellipse Grid.Column="0" Width="10" Height="10" Margin="0,0,10,0"
|
||||
VerticalAlignment="Center">
|
||||
<Ellipse.Style>
|
||||
<Style TargetType="Ellipse">
|
||||
<Setter Property="Fill" Value="{StaticResource StatusGrayBrush}"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Status}" Value="Running">
|
||||
<Setter Property="Fill" Value="{StaticResource StatusOrangeBrush}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="Done">
|
||||
<Setter Property="Fill" Value="{StaticResource StatusGreenBrush}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="Failed">
|
||||
<Setter Property="Fill" Value="{StaticResource StatusRedBrush}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Ellipse.Style>
|
||||
</Ellipse>
|
||||
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}" FontSize="13"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Messages (expandable) -->
|
||||
<ItemsControl ItemsSource="{Binding Messages}" Margin="20,4,0,0"
|
||||
Visibility="{Binding IsExpanded, Converter={StaticResource BoolToVisConverter}}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" FontSize="11" FontFamily="Consolas"
|
||||
Foreground="{StaticResource TextDimBrush}"
|
||||
TextWrapping="Wrap"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Progress Bar -->
|
||||
<ProgressBar Grid.Row="2" Value="{Binding OverallProgress}" Maximum="100"
|
||||
Margin="0,12,0,0"
|
||||
Visibility="{Binding IsInstalling, Converter={StaticResource BoolToVisConverter}}"/>
|
||||
|
||||
<!-- Action buttons -->
|
||||
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0">
|
||||
<Button Content="Cancel" Command="{Binding CancelInstallCommand}"
|
||||
Visibility="{Binding IsInstalling, Converter={StaticResource BoolToVisConverter}}"
|
||||
Margin="0,0,8,0"/>
|
||||
|
||||
<Button Content="Launch ClaudeDo" Command="{Binding LaunchAppCommand}"
|
||||
Style="{StaticResource AccentButton}"
|
||||
Visibility="{Binding IsComplete, Converter={StaticResource BoolToVisConverter}}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.InstallPage;
|
||||
|
||||
public partial class InstallPageView : UserControl
|
||||
{
|
||||
public InstallPageView() => InitializeComponent();
|
||||
}
|
||||
120
src/ClaudeDo.Installer/Pages/InstallPage/InstallPageViewModel.cs
Normal file
120
src/ClaudeDo.Installer/Pages/InstallPage/InstallPageViewModel.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using ClaudeDo.Installer.Core;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.InstallPage;
|
||||
|
||||
public partial class InstallPageViewModel : ObservableObject, IInstallerPage
|
||||
{
|
||||
private readonly InstallContext _context;
|
||||
private readonly InstallerService _installerService;
|
||||
private InstallPageView? _view;
|
||||
private CancellationTokenSource? _cts;
|
||||
|
||||
public string Title => "Install";
|
||||
public string Icon => "\uE896";
|
||||
public int Order => 99;
|
||||
public bool ShowInWizard => true;
|
||||
public bool ShowInSettings => false;
|
||||
public UserControl View => _view ??= new InstallPageView { DataContext = this };
|
||||
|
||||
public ObservableCollection<StepViewModel> Steps { get; } = [];
|
||||
|
||||
[ObservableProperty] private bool _isInstalling;
|
||||
[ObservableProperty] private bool _isComplete;
|
||||
[ObservableProperty] private bool _hasErrors;
|
||||
[ObservableProperty] private double _overallProgress;
|
||||
|
||||
public InstallPageViewModel(InstallContext context, InstallerService installerService)
|
||||
{
|
||||
_context = context;
|
||||
_installerService = installerService;
|
||||
}
|
||||
|
||||
public Task LoadAsync()
|
||||
{
|
||||
Steps.Clear();
|
||||
Steps.Add(new StepViewModel("Publish ClaudeDo.App"));
|
||||
Steps.Add(new StepViewModel("Publish ClaudeDo.Worker"));
|
||||
Steps.Add(new StepViewModel("Deploy Binaries"));
|
||||
Steps.Add(new StepViewModel("Write Configuration"));
|
||||
Steps.Add(new StepViewModel("Initialize Database"));
|
||||
Steps.Add(new StepViewModel("Register Windows Service"));
|
||||
Steps.Add(new StepViewModel("Create Shortcuts"));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task ApplyAsync() => RunInstallAsync();
|
||||
|
||||
public bool Validate() => true;
|
||||
|
||||
[RelayCommand]
|
||||
private async Task RunInstallAsync()
|
||||
{
|
||||
if (IsInstalling) return;
|
||||
|
||||
IsInstalling = true;
|
||||
IsComplete = false;
|
||||
HasErrors = false;
|
||||
OverallProgress = 0;
|
||||
|
||||
_cts = new CancellationTokenSource();
|
||||
|
||||
var progress = new Progress<StepProgress>(p =>
|
||||
{
|
||||
var step = Steps.FirstOrDefault(s => s.Name == p.StepName);
|
||||
if (step is null) return;
|
||||
|
||||
step.Status = p.Status;
|
||||
if (p.Message is not null)
|
||||
step.Messages.Add(p.Message);
|
||||
|
||||
if (p.Status is StepStatus.Running && !step.IsExpanded)
|
||||
step.IsExpanded = true;
|
||||
|
||||
if (p.Status is StepStatus.Done or StepStatus.Failed)
|
||||
{
|
||||
var completed = Steps.Count(s => s.Status is StepStatus.Done or StepStatus.Failed);
|
||||
OverallProgress = (double)completed / Steps.Count * 100;
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
var results = await _installerService.ExecuteAsync(_context, progress, _cts.Token);
|
||||
HasErrors = results.Any(r => !r.Result.Success);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
HasErrors = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsInstalling = false;
|
||||
IsComplete = true;
|
||||
_cts.Dispose();
|
||||
_cts = null;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void CancelInstall()
|
||||
{
|
||||
_cts?.Cancel();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void LaunchApp()
|
||||
{
|
||||
var appExe = System.IO.Path.Combine(_context.InstallDirectory, "app", "ClaudeDo.App.exe");
|
||||
if (System.IO.File.Exists(appExe))
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(appExe) { UseShellExecute = true });
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
17
src/ClaudeDo.Installer/Pages/InstallPage/StepViewModel.cs
Normal file
17
src/ClaudeDo.Installer/Pages/InstallPage/StepViewModel.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using ClaudeDo.Installer.Core;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.InstallPage;
|
||||
|
||||
public partial class StepViewModel : ObservableObject
|
||||
{
|
||||
public string Name { get; }
|
||||
|
||||
[ObservableProperty] private StepStatus _status = StepStatus.Pending;
|
||||
[ObservableProperty] private bool _isExpanded;
|
||||
|
||||
public ObservableCollection<string> Messages { get; } = [];
|
||||
|
||||
public StepViewModel(string name) => Name = name;
|
||||
}
|
||||
41
src/ClaudeDo.Installer/Pages/PathsPage/PathsPageView.xaml
Normal file
41
src/ClaudeDo.Installer/Pages/PathsPage/PathsPageView.xaml
Normal file
@@ -0,0 +1,41 @@
|
||||
<UserControl x:Class="ClaudeDo.Installer.Pages.PathsPage.PathsPageView"
|
||||
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.PathsPage"
|
||||
d:DataContext="{d:DesignInstance local:PathsPageViewModel}"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel MaxWidth="520">
|
||||
<TextBlock Text="Data Paths" FontSize="18" FontWeight="SemiBold" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Configure where ClaudeDo stores its data."
|
||||
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,0,0,20"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<Label Content="Database Path"/>
|
||||
<TextBox Text="{Binding DbPath, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,12"/>
|
||||
|
||||
<Label Content="Log Directory"/>
|
||||
<TextBox Text="{Binding LogRoot, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,12"/>
|
||||
|
||||
<Label Content="Sandbox Root"/>
|
||||
<TextBox Text="{Binding SandboxRoot, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,12"/>
|
||||
|
||||
<Label Content="Worktree Strategy"/>
|
||||
<ComboBox SelectedItem="{Binding WorktreeRootStrategy}" Margin="0,0,0,12">
|
||||
<sys:String xmlns:sys="clr-namespace:System;assembly=mscorlib">sibling</sys:String>
|
||||
<sys:String xmlns:sys="clr-namespace:System;assembly=mscorlib">central</sys:String>
|
||||
</ComboBox>
|
||||
|
||||
<StackPanel Visibility="{Binding IsCentralVisible, Converter={StaticResource BoolToVisConverter}}">
|
||||
<Label Content="Central Worktree Root"/>
|
||||
<TextBox Text="{Binding CentralWorktreeRoot, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,12"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Text="{Binding ValidationError}" Foreground="{StaticResource ErrorBrush}" FontSize="11"
|
||||
Visibility="{Binding ValidationError, Converter={StaticResource NullToCollapsedConverter}}"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.PathsPage;
|
||||
|
||||
public partial class PathsPageView : UserControl
|
||||
{
|
||||
public PathsPageView() => InitializeComponent();
|
||||
}
|
||||
74
src/ClaudeDo.Installer/Pages/PathsPage/PathsPageViewModel.cs
Normal file
74
src/ClaudeDo.Installer/Pages/PathsPage/PathsPageViewModel.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System.Windows.Controls;
|
||||
using ClaudeDo.Installer.Core;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.PathsPage;
|
||||
|
||||
public partial class PathsPageViewModel : ObservableObject, IInstallerPage
|
||||
{
|
||||
private readonly InstallContext _context;
|
||||
private PathsPageView? _view;
|
||||
|
||||
public string Title => "Paths";
|
||||
public string Icon => "\uE8B7";
|
||||
public int Order => 1;
|
||||
public bool ShowInWizard => true;
|
||||
public bool ShowInSettings => true;
|
||||
public UserControl View => _view ??= new PathsPageView { DataContext = this };
|
||||
|
||||
[ObservableProperty] private string _dbPath = "~/.todo-app/todo.db";
|
||||
[ObservableProperty] private string _logRoot = "~/.todo-app/logs";
|
||||
[ObservableProperty] private string _sandboxRoot = "~/.todo-app/sandbox";
|
||||
[ObservableProperty] private string _worktreeRootStrategy = "sibling";
|
||||
[ObservableProperty] private string _centralWorktreeRoot = "~/.todo-app/worktrees";
|
||||
[ObservableProperty] private string? _validationError;
|
||||
|
||||
public bool IsCentralVisible => WorktreeRootStrategy == "central";
|
||||
|
||||
public PathsPageViewModel(InstallContext context) => _context = context;
|
||||
|
||||
partial void OnWorktreeRootStrategyChanged(string value) =>
|
||||
OnPropertyChanged(nameof(IsCentralVisible));
|
||||
|
||||
public Task LoadAsync()
|
||||
{
|
||||
var cfg = InstallerWorkerConfig.Load();
|
||||
DbPath = cfg.DbPath;
|
||||
LogRoot = cfg.LogRoot;
|
||||
SandboxRoot = cfg.SandboxRoot;
|
||||
WorktreeRootStrategy = cfg.WorktreeRootStrategy;
|
||||
CentralWorktreeRoot = cfg.CentralWorktreeRoot;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task ApplyAsync()
|
||||
{
|
||||
_context.DbPath = DbPath;
|
||||
_context.UiDbPath = DbPath;
|
||||
_context.LogRoot = LogRoot;
|
||||
_context.SandboxRoot = SandboxRoot;
|
||||
_context.WorktreeRootStrategy = WorktreeRootStrategy;
|
||||
_context.CentralWorktreeRoot = CentralWorktreeRoot;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public bool Validate()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(DbPath) ||
|
||||
string.IsNullOrWhiteSpace(LogRoot) ||
|
||||
string.IsNullOrWhiteSpace(SandboxRoot))
|
||||
{
|
||||
ValidationError = "All path fields are required.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WorktreeRootStrategy == "central" && string.IsNullOrWhiteSpace(CentralWorktreeRoot))
|
||||
{
|
||||
ValidationError = "Central worktree root is required when using central strategy.";
|
||||
return false;
|
||||
}
|
||||
|
||||
ValidationError = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<UserControl x:Class="ClaudeDo.Installer.Pages.ServicePage.ServicePageView"
|
||||
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.ServicePage"
|
||||
d:DataContext="{d:DesignInstance local:ServicePageViewModel}"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel MaxWidth="520">
|
||||
<TextBlock Text="Worker Service" FontSize="18" FontWeight="SemiBold" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Configure the ClaudeDo Worker background service."
|
||||
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,0,0,20"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<Label Content="SignalR Port"/>
|
||||
<TextBox Text="{Binding SignalRPort, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,12"/>
|
||||
|
||||
<Label Content="Queue Backstop Interval (ms)"/>
|
||||
<TextBox Text="{Binding QueueBackstopIntervalMs, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,12"/>
|
||||
|
||||
<Label Content="Claude CLI Path"/>
|
||||
<Grid Margin="0,0,0,12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Grid.Column="0" Text="{Binding ClaudeBin, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Grid.Column="1" Content="Browse..." Command="{Binding BrowseClaudeCommand}"
|
||||
Margin="8,0,0,0"/>
|
||||
</Grid>
|
||||
|
||||
<Separator Margin="0,4,0,12"/>
|
||||
|
||||
<Label Content="Service Account"/>
|
||||
<StackPanel Margin="0,0,0,12">
|
||||
<RadioButton Content="Local System (recommended)"
|
||||
IsChecked="{Binding IsLocalSystem}" Margin="0,0,0,4"/>
|
||||
<RadioButton Content="Current User"
|
||||
IsChecked="{Binding IsCurrentUser}"/>
|
||||
<TextBlock Text="Running as current user requires 'Log on as a service' privilege."
|
||||
Foreground="{StaticResource TextDimBrush}" FontSize="11" Margin="20,2,0,0"
|
||||
TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox Content="Start service automatically" IsChecked="{Binding AutoStart}" Margin="0,0,0,12"/>
|
||||
|
||||
<Label Content="Restart Delay (ms)"/>
|
||||
<TextBox Text="{Binding RestartDelayMs, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,12"/>
|
||||
|
||||
<TextBlock Text="{Binding ValidationError}" Foreground="{StaticResource ErrorBrush}" FontSize="11"
|
||||
Visibility="{Binding ValidationError, Converter={StaticResource NullToCollapsedConverter}}"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.ServicePage;
|
||||
|
||||
public partial class ServicePageView : UserControl
|
||||
{
|
||||
public ServicePageView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System.Windows.Controls;
|
||||
using ClaudeDo.Installer.Core;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.ServicePage;
|
||||
|
||||
public partial class ServicePageViewModel : ObservableObject, IInstallerPage
|
||||
{
|
||||
private readonly InstallContext _context;
|
||||
private ServicePageView? _view;
|
||||
|
||||
public string Title => "Service";
|
||||
public string Icon => "\uE912";
|
||||
public int Order => 2;
|
||||
public bool ShowInWizard => true;
|
||||
public bool ShowInSettings => true;
|
||||
public UserControl View => _view ??= new ServicePageView { DataContext = this };
|
||||
|
||||
[ObservableProperty] private int _signalRPort = 47_821;
|
||||
[ObservableProperty] private int _queueBackstopIntervalMs = 30_000;
|
||||
[ObservableProperty] private string _claudeBin = "claude";
|
||||
[ObservableProperty] private bool _isLocalSystem = true;
|
||||
[ObservableProperty] private bool _isCurrentUser;
|
||||
[ObservableProperty] private bool _autoStart = true;
|
||||
[ObservableProperty] private int _restartDelayMs = 5000;
|
||||
[ObservableProperty] private string? _validationError;
|
||||
|
||||
public ServicePageViewModel(InstallContext context) => _context = context;
|
||||
|
||||
public Task LoadAsync()
|
||||
{
|
||||
var cfg = InstallerWorkerConfig.Load();
|
||||
SignalRPort = cfg.SignalRPort;
|
||||
QueueBackstopIntervalMs = cfg.QueueBackstopIntervalMs;
|
||||
ClaudeBin = cfg.ClaudeBin;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task ApplyAsync()
|
||||
{
|
||||
_context.SignalRPort = SignalRPort;
|
||||
_context.QueueBackstopIntervalMs = QueueBackstopIntervalMs;
|
||||
_context.ClaudeBin = ClaudeBin;
|
||||
_context.ServiceAccount = IsCurrentUser ? "CurrentUser" : "LocalSystem";
|
||||
_context.AutoStart = AutoStart;
|
||||
_context.RestartDelayMs = RestartDelayMs;
|
||||
_context.SignalRUrl = $"http://127.0.0.1:{SignalRPort}/hub";
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public bool Validate()
|
||||
{
|
||||
if (SignalRPort < 1024 || SignalRPort > 65535)
|
||||
{
|
||||
ValidationError = "Port must be between 1024 and 65535.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (QueueBackstopIntervalMs <= 0)
|
||||
{
|
||||
ValidationError = "Queue backstop interval must be greater than 0.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(ClaudeBin))
|
||||
{
|
||||
ValidationError = "Claude CLI path is required.";
|
||||
return false;
|
||||
}
|
||||
|
||||
ValidationError = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void BrowseClaude()
|
||||
{
|
||||
var dialog = new OpenFileDialog
|
||||
{
|
||||
Title = "Select Claude CLI executable",
|
||||
Filter = "Executables (*.exe)|*.exe|All files (*.*)|*.*",
|
||||
};
|
||||
if (dialog.ShowDialog() == true)
|
||||
ClaudeBin = dialog.FileName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<UserControl x:Class="ClaudeDo.Installer.Pages.UiSettingsPage.UiSettingsPageView"
|
||||
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.UiSettingsPage"
|
||||
d:DataContext="{d:DesignInstance local:UiSettingsPageViewModel}"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel MaxWidth="520">
|
||||
<TextBlock Text="UI Settings" FontSize="18" FontWeight="SemiBold" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Configure the ClaudeDo desktop UI connection settings."
|
||||
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,0,0,20"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<CheckBox Content="Sync with service settings" IsChecked="{Binding IsSynced}" Margin="0,0,0,16"/>
|
||||
|
||||
<Label Content="SignalR URL"/>
|
||||
<TextBox Text="{Binding SignalRUrl, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="{Binding IsSynced}" Margin="0,0,0,12"/>
|
||||
|
||||
<Label Content="Database Path"/>
|
||||
<TextBox Text="{Binding UiDbPath, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="{Binding IsSynced}" Margin="0,0,0,12"/>
|
||||
|
||||
<TextBlock Text="When synced, these values are derived from the Service and Paths pages."
|
||||
Foreground="{StaticResource TextDimBrush}" FontSize="11" TextWrapping="Wrap"
|
||||
Visibility="{Binding IsSynced, Converter={StaticResource BoolToVisConverter}}"
|
||||
Margin="0,0,0,12"/>
|
||||
|
||||
<TextBlock Text="{Binding ValidationError}" Foreground="{StaticResource ErrorBrush}" FontSize="11"
|
||||
Visibility="{Binding ValidationError, Converter={StaticResource NullToCollapsedConverter}}"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.UiSettingsPage;
|
||||
|
||||
public partial class UiSettingsPageView : UserControl
|
||||
{
|
||||
public UiSettingsPageView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using System.Windows.Controls;
|
||||
using ClaudeDo.Installer.Core;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.UiSettingsPage;
|
||||
|
||||
public partial class UiSettingsPageViewModel : ObservableObject, IInstallerPage
|
||||
{
|
||||
private readonly InstallContext _context;
|
||||
private UiSettingsPageView? _view;
|
||||
|
||||
public string Title => "UI Settings";
|
||||
public string Icon => "\uE771";
|
||||
public int Order => 3;
|
||||
public bool ShowInWizard => true;
|
||||
public bool ShowInSettings => true;
|
||||
public UserControl View => _view ??= new UiSettingsPageView { DataContext = this };
|
||||
|
||||
[ObservableProperty] private string _signalRUrl = "http://127.0.0.1:47821/hub";
|
||||
[ObservableProperty] private string _uiDbPath = "~/.todo-app/todo.db";
|
||||
[ObservableProperty] private bool _isSynced = true;
|
||||
[ObservableProperty] private string? _validationError;
|
||||
|
||||
public UiSettingsPageViewModel(InstallContext context) => _context = context;
|
||||
|
||||
partial void OnIsSyncedChanged(bool value)
|
||||
{
|
||||
if (value) SyncFromContext();
|
||||
}
|
||||
|
||||
private void SyncFromContext()
|
||||
{
|
||||
SignalRUrl = $"http://127.0.0.1:{_context.SignalRPort}/hub";
|
||||
UiDbPath = _context.DbPath;
|
||||
}
|
||||
|
||||
public Task LoadAsync()
|
||||
{
|
||||
if (IsSynced)
|
||||
{
|
||||
SyncFromContext();
|
||||
}
|
||||
else
|
||||
{
|
||||
var cfg = InstallerAppSettings.Load();
|
||||
SignalRUrl = cfg.SignalRUrl;
|
||||
UiDbPath = cfg.DbPath;
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task ApplyAsync()
|
||||
{
|
||||
if (IsSynced) SyncFromContext();
|
||||
_context.SignalRUrl = SignalRUrl;
|
||||
_context.UiDbPath = UiDbPath;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public bool Validate()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(SignalRUrl))
|
||||
{
|
||||
ValidationError = "SignalR URL is required.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(UiDbPath))
|
||||
{
|
||||
ValidationError = "Database path is required.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Uri.TryCreate(SignalRUrl, UriKind.Absolute, out _))
|
||||
{
|
||||
ValidationError = "SignalR URL must be a valid URL.";
|
||||
return false;
|
||||
}
|
||||
|
||||
ValidationError = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<UserControl x:Class="ClaudeDo.Installer.Pages.WelcomePage.WelcomePageView"
|
||||
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.WelcomePage"
|
||||
d:DataContext="{d:DesignInstance local:WelcomePageViewModel}"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel MaxWidth="520">
|
||||
<TextBlock Text="Welcome to ClaudeDo Setup" FontSize="20" FontWeight="SemiBold"
|
||||
Margin="0,0,0,6"/>
|
||||
<TextBlock Text="This wizard will build, configure, and install ClaudeDo on your machine."
|
||||
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,0,0,24"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<!-- Source Directory -->
|
||||
<Label Content="Source Directory"/>
|
||||
<Grid Margin="0,0,0,4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Grid.Column="0" Text="{Binding SourceDirectory, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Grid.Column="1" Content="Browse..." Command="{Binding BrowseSourceCommand}"
|
||||
Margin="8,0,0,0"/>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding SourceError}" Foreground="{StaticResource ErrorBrush}" FontSize="11"
|
||||
Visibility="{Binding SourceError, Converter={StaticResource NullToCollapsedConverter}}"
|
||||
Margin="0,0,0,16"/>
|
||||
|
||||
<!-- Install Directory -->
|
||||
<Label Content="Install Directory"/>
|
||||
<Grid Margin="0,0,0,4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Grid.Column="0" Text="{Binding InstallDirectory, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Grid.Column="1" Content="Browse..." Command="{Binding BrowseInstallCommand}"
|
||||
Margin="8,0,0,0"/>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding InstallError}" Foreground="{StaticResource ErrorBrush}" FontSize="11"
|
||||
Visibility="{Binding InstallError, Converter={StaticResource NullToCollapsedConverter}}"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.WelcomePage;
|
||||
|
||||
public partial class WelcomePageView : UserControl
|
||||
{
|
||||
public WelcomePageView() => InitializeComponent();
|
||||
}
|
||||
106
src/ClaudeDo.Installer/Pages/WelcomePage/WelcomePageViewModel.cs
Normal file
106
src/ClaudeDo.Installer/Pages/WelcomePage/WelcomePageViewModel.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System.IO;
|
||||
using System.Windows.Controls;
|
||||
using ClaudeDo.Installer.Core;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace ClaudeDo.Installer.Pages.WelcomePage;
|
||||
|
||||
public partial class WelcomePageViewModel : ObservableObject, IInstallerPage
|
||||
{
|
||||
private readonly InstallContext _context;
|
||||
private WelcomePageView? _view;
|
||||
|
||||
public string Title => "Welcome";
|
||||
public string Icon => "\uE80F";
|
||||
public int Order => 0;
|
||||
public bool ShowInWizard => true;
|
||||
public bool ShowInSettings => false;
|
||||
public UserControl View => _view ??= new WelcomePageView { DataContext = this };
|
||||
|
||||
[ObservableProperty] private string _sourceDirectory = "";
|
||||
[ObservableProperty] private string _installDirectory = @"C:\Program Files\ClaudeDo";
|
||||
[ObservableProperty] private string? _sourceError;
|
||||
[ObservableProperty] private string? _installError;
|
||||
|
||||
public WelcomePageViewModel(InstallContext context)
|
||||
{
|
||||
_context = context;
|
||||
_sourceDirectory = DetectSourceDirectory();
|
||||
}
|
||||
|
||||
public Task LoadAsync()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_context.SourceDirectory))
|
||||
SourceDirectory = _context.SourceDirectory;
|
||||
if (!string.IsNullOrEmpty(_context.InstallDirectory))
|
||||
InstallDirectory = _context.InstallDirectory;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task ApplyAsync()
|
||||
{
|
||||
_context.SourceDirectory = SourceDirectory;
|
||||
_context.InstallDirectory = InstallDirectory;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public bool Validate()
|
||||
{
|
||||
var valid = true;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(SourceDirectory) ||
|
||||
!File.Exists(Path.Combine(SourceDirectory, "ClaudeDo.slnx")))
|
||||
{
|
||||
SourceError = "Source directory must contain ClaudeDo.slnx";
|
||||
valid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SourceError = null;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(InstallDirectory))
|
||||
{
|
||||
InstallError = "Install directory is required";
|
||||
valid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
InstallError = null;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void BrowseSource()
|
||||
{
|
||||
var dialog = new OpenFolderDialog { Title = "Select ClaudeDo source directory" };
|
||||
if (dialog.ShowDialog() == true)
|
||||
SourceDirectory = dialog.FolderName;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void BrowseInstall()
|
||||
{
|
||||
var dialog = new OpenFolderDialog { Title = "Select installation directory" };
|
||||
if (dialog.ShowDialog() == true)
|
||||
InstallDirectory = dialog.FolderName;
|
||||
}
|
||||
|
||||
private static string DetectSourceDirectory()
|
||||
{
|
||||
var dir = AppContext.BaseDirectory;
|
||||
for (var i = 0; i < 8; i++)
|
||||
{
|
||||
if (File.Exists(Path.Combine(dir, "ClaudeDo.slnx")))
|
||||
return dir;
|
||||
var parent = Directory.GetParent(dir)?.FullName;
|
||||
if (parent is null) break;
|
||||
dir = parent;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user