From 72687e9b305966032edd06b4384c9f4b1d592515 Mon Sep 17 00:00:00 2001 From: mika kuns Date: Fri, 5 Jun 2026 11:00:37 +0200 Subject: [PATCH] feat(ui): expose conflict-resolver factory and dialog seam for integrator --- src/ClaudeDo.App/Program.cs | 11 ++++++++++- .../ViewModels/IslandsShellViewModel.cs | 14 ++++++++++++++ src/ClaudeDo.Ui/Views/MainWindow.axaml.cs | 5 +++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/ClaudeDo.App/Program.cs b/src/ClaudeDo.App/Program.cs index 0c68eb0..3a28694 100644 --- a/src/ClaudeDo.App/Program.cs +++ b/src/ClaudeDo.App/Program.cs @@ -132,6 +132,9 @@ sealed class Program sc.AddTransient>(sp => () => sp.GetRequiredService()); sc.AddTransient(); sc.AddTransient>(sp => () => sp.GetRequiredService()); + sc.AddSingleton>(sp => + taskId => new ClaudeDo.Ui.ViewModels.Conflicts.ConflictResolverViewModel( + sp.GetRequiredService(), taskId)); // Islands shell VMs sc.AddSingleton(sp => @@ -149,7 +152,13 @@ sealed class Program sp.GetRequiredService(), sp, sp.GetRequiredService())); - sc.AddSingleton(); + sc.AddSingleton(sp => + { + var shell = ActivatorUtilities.CreateInstance(sp); + shell.ConflictResolverFactory = + sp.GetRequiredService>(); + return shell; + }); return sc.BuildServiceProvider(); } diff --git a/src/ClaudeDo.Ui/ViewModels/IslandsShellViewModel.cs b/src/ClaudeDo.Ui/ViewModels/IslandsShellViewModel.cs index 9c46ccb..c0887e9 100644 --- a/src/ClaudeDo.Ui/ViewModels/IslandsShellViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/IslandsShellViewModel.cs @@ -44,6 +44,20 @@ public sealed partial class IslandsShellViewModel : ViewModelBase // Set by MainWindow to open the conflict resolution dialog. public Func? ShowConflictDialog { get; set; } + // Layer C seam: composition root sets the factory; MainWindow sets the dialog opener. + // The integrator connects Layer A/B's RequestConflictResolution(taskId, target) to this method. + public Func? ConflictResolverFactory { get; set; } + public Func? ShowConflictResolver { get; set; } + + public async Task RequestConflictResolutionAsync(string taskId, string targetBranch) + { + if (ConflictResolverFactory is null || ShowConflictResolver is null) return; + var vm = ConflictResolverFactory(taskId); + var hasConflicts = await vm.OpenAsync(targetBranch); + if (hasConflicts) + await ShowConflictResolver(vm); + } + // Set by MainWindow to open the About dialog. public Func? ShowAboutModal { get; set; } diff --git a/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs b/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs index 0581d82..4dcfcc7 100644 --- a/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs +++ b/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs @@ -95,6 +95,11 @@ public partial class MainWindow : Window connVm.CloseAction = () => dlg.Close(); await dlg.ShowDialog(this); }; + vm.ShowConflictResolver = async (resolverVm) => + { + var dlg = new ClaudeDo.Ui.Views.Conflicts.ConflictResolverView { DataContext = resolverVm }; + await dlg.ShowDialog(this); + }; } }