diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..8b4893a --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,6 @@ +{ + "enabledPlugins": { + "posthog@claude-plugins-official": true, + "playwright@claude-plugins-official": true + } +} diff --git a/gclo.Engine.Tests/MainViewModelTests.cs b/gclo.Engine.Tests/MainViewModelTests.cs index ec5312a..22dbee8 100644 --- a/gclo.Engine.Tests/MainViewModelTests.cs +++ b/gclo.Engine.Tests/MainViewModelTests.cs @@ -176,6 +176,42 @@ public sealed class MainViewModelTests Directory.Delete(vm.TargetFolder, recursive: true); } + [Fact] + public async Task Sync_RepoFailure_RaisesAssistiveAnnouncement() + { + _git.CloneHandler = (url, path, token, onProgress, ct) => + Path.GetFileName(path) == "bravo" + ? Task.FromException(new InvalidOperationException("boom")) + : Task.CompletedTask; + + var vm = await CreateLoadedViewModelAsync(Repo("alpha"), Repo("bravo")); + var announcements = new List(); + vm.AnnouncementRequested += announcements.Add; + + await vm.SyncCommand.ExecuteAsync(null); + + var announcement = Assert.Single(announcements); + Assert.Contains("bravo", announcement); + Assert.Contains("failed", announcement); + Assert.Contains("boom", announcement); + + Directory.Delete(vm.TargetFolder, recursive: true); + } + + [Fact] + public async Task Sync_AllSucceed_RaisesNoAnnouncements() + { + var vm = await CreateLoadedViewModelAsync(Repo("alpha"), Repo("bravo")); + var announcements = new List(); + vm.AnnouncementRequested += announcements.Add; + + await vm.SyncCommand.ExecuteAsync(null); + + Assert.Empty(announcements); + + Directory.Delete(vm.TargetFolder, recursive: true); + } + [Fact] public async Task Sync_CancelCommand_CancelsRun_AndReportsCanceled() { diff --git a/gclo.ViewModels/MainViewModel.cs b/gclo.ViewModels/MainViewModel.cs index a9d864d..44797e7 100644 --- a/gclo.ViewModels/MainViewModel.cs +++ b/gclo.ViewModels/MainViewModel.cs @@ -561,6 +561,13 @@ public sealed partial class MainViewModel : ObservableObject, IDisposable // ---------------------------------------------------------------- progress + /// + /// Raised with a message that assistive technology should announce. Per-repo + /// failures use this channel; run summaries land in , + /// whose live region already announces changes. Raised on the UI thread. + /// + public event Action? AnnouncementRequested; + /// Applies one engine progress report to the table. Runs on the UI thread. private void HandleProgress(RepoProgress report) { @@ -580,6 +587,9 @@ public sealed partial class MainViewModel : ObservableObject, IDisposable if (report.Status == SyncStatus.Failed) { _log.Error($"{report.RepoName} failed: {report.Error}"); + // Failures never reach StatusText (which has a live region), so assistive + // technology hears them only through this explicit channel. + AnnouncementRequested?.Invoke($"{report.RepoName} failed. {report.Error}"); } if (report.Status is SyncStatus.Done or SyncStatus.Failed or SyncStatus.Canceled) diff --git a/gclo/App.xaml.cs b/gclo/App.xaml.cs index ae2cda4..0c4c833 100644 --- a/gclo/App.xaml.cs +++ b/gclo/App.xaml.cs @@ -1,3 +1,4 @@ +using gclo.ViewModels; using Microsoft.UI.Xaml; namespace gclo @@ -16,6 +17,20 @@ namespace gclo public App() { InitializeComponent(); + + // App-level so Application.Current.Resources theme lookups (the status + // brushes) agree with the visible theme. Only settable here, before any + // window exists; mid-session theme changes still use the root element's + // RequestedTheme, and status brushes adopt them as row statuses update. + string theme = AppSettings.Load().Theme; + if (theme == "Light") + { + RequestedTheme = ApplicationTheme.Light; + } + else if (theme == "Dark") + { + RequestedTheme = ApplicationTheme.Dark; + } } /// diff --git a/gclo/MainWindow.xaml b/gclo/MainWindow.xaml index 6c37a5a..2e630ba 100644 --- a/gclo/MainWindow.xaml +++ b/gclo/MainWindow.xaml @@ -78,6 +78,7 @@ Height="20" Margin="0,0,0,8" VerticalAlignment="Bottom" + AutomationProperties.Name="Loading organizations" IsActive="{x:Bind ViewModel.IsLoadingOrgs, Mode=OneWay}" /> @@ -134,6 +135,7 @@ Width="20" Height="20" VerticalAlignment="Center" + AutomationProperties.Name="Loading repositories" IsActive="{x:Bind ViewModel.IsLoadingRepos, Mode=OneWay}" />