feat(ui): add Restore default agents button to Settings modal

This commit is contained in:
mika kuns
2026-04-23 12:21:02 +02:00
parent 1830273a9d
commit e70ae7f6ce
2 changed files with 43 additions and 0 deletions

View File

@@ -161,6 +161,32 @@ public sealed partial class SettingsModalViewModel : ViewModelBase
finally { IsBusy = false; }
}
[RelayCommand]
private async Task RestoreDefaultAgents()
{
IsBusy = true;
StatusMessage = "";
try
{
var result = await _worker.RestoreDefaultAgentsAsync();
if (result is null)
StatusMessage = "Worker offline.";
else if (result.Copied == 0 && result.Skipped == 0)
StatusMessage = "No default agents bundled.";
else if (result.Copied == 0)
StatusMessage = "All default agents already present.";
else
StatusMessage = $"Restored {result.Copied} default agent(s).";
await _worker.RefreshAgentsAsync();
}
catch (Exception ex)
{
StatusMessage = $"Restore failed: {ex.Message}";
}
finally { IsBusy = false; }
}
[RelayCommand]
private void OpenPath(string? path)
{

View File

@@ -184,6 +184,23 @@
</Border>
</StackPanel>
<!-- AGENTS -->
<StackPanel Spacing="0">
<TextBlock Classes="section-label" Text="AGENTS"/>
<Border Classes="section">
<StackPanel Spacing="8">
<TextBlock Text="Restore bundled default agents (code-reviewer, test-writer, debugger, security-reviewer, explorer, researcher). Existing files are not overwritten."
FontSize="11"
TextWrapping="Wrap"
Foreground="{DynamicResource TextDimBrush}"/>
<Button Content="Restore default agents"
Command="{Binding RestoreDefaultAgentsCommand}"
IsEnabled="{Binding !IsBusy}"
HorizontalAlignment="Left"/>
</StackPanel>
</Border>
</StackPanel>
<!-- ABOUT -->
<StackPanel Spacing="0">
<TextBlock Classes="section-label" Text="ABOUT"/>