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:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user