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,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