refactor: address code smells (run-dir helper, App DI injection)
- TaskRunner: extract worktree-vs-sandbox selection into PrepareRunDirectoryAsync so RunAsync reads linearly (a small helper, not a Strategy pattern — overkill for a two-way branch). - App: drop the public static ServiceProvider locator; inject the provider via constructor through AppBuilder.Configure(() => new App(services)). Parameterless ctor + BuildAvaloniaApp() retained for the XAML designer. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -35,7 +35,6 @@ sealed class Program
|
||||
SetCurrentProcessExplicitAppUserModelID("ClaudeDo.App");
|
||||
|
||||
var services = BuildServices();
|
||||
App.Services = services;
|
||||
|
||||
using (var scope = services.CreateScope())
|
||||
{
|
||||
@@ -45,7 +44,7 @@ sealed class Program
|
||||
|
||||
try
|
||||
{
|
||||
BuildAvaloniaApp()
|
||||
ConfigureAppBuilder(AppBuilder.Configure(() => new App(services)))
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
finally
|
||||
@@ -58,8 +57,12 @@ sealed class Program
|
||||
}
|
||||
}
|
||||
|
||||
// Parameterless entry point required by the XAML previewer / designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
=> ConfigureAppBuilder(AppBuilder.Configure<App>());
|
||||
|
||||
private static AppBuilder ConfigureAppBuilder(AppBuilder builder)
|
||||
=> builder
|
||||
.UsePlatformDetect()
|
||||
#if DEBUG
|
||||
.WithDeveloperTools()
|
||||
|
||||
Reference in New Issue
Block a user