-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
Phase 5: CLI Presentation
Wire dependency injection composition root and verify AOT compilation.
ServiceRegistration
In Infrastructure/Cli/Composition/ServiceRegistration.cs
Register all services:
public static class ServiceRegistration
{
public static IServiceCollection AddDevSweepServices(
this IServiceCollection services,
OutputFormat outputFormat,
bool autoConfirm)
{
// Domain services
services.AddSingleton<VersionSorter>();
// Use cases
services.AddScoped<IAnalyzeUseCase, AnalyzeUseCase>();
services.AddScoped<ICleanupUseCase, CleanupUseCase>();
services.AddScoped<IModuleDiscoveryUseCase, ModuleDiscoveryUseCase>();
// Infrastructure adapters
services.AddSingleton<IFileSystem, PhysicalFileSystem>();
services.AddSingleton<IProcessManager, SystemProcessManager>();
services.AddSingleton<ICommandRunner, SystemCommandRunner>();
services.AddSingleton<IEnvironmentProvider, SystemEnvironmentProvider>();
// Output formatter strategy
services.AddSingleton<IOutputFormatter>(sp => outputFormat switch
{
OutputFormat.Rich => new SpectreOutputFormatter(),
OutputFormat.Plain => new PlainTextOutputFormatter(),
OutputFormat.Json => new JsonOutputFormatter(),
_ => new SpectreOutputFormatter()
});
// Interaction strategy
services.AddSingleton<IUserInteraction>(sp => autoConfirm
? new AutoConfirmInteraction()
: new InteractiveConsole());
// Module registry
var registry = new ModuleRegistry();
registry.Register(new JetBrainsModule());
registry.Register(new DockerModule());
registry.Register(new HomebrewModule());
registry.Register(new DevToolsModule());
registry.Register(new StaleProjectsModule());
registry.Register(new SystemModule());
services.AddSingleton(registry);
return services;
}
}Program.cs
Entry point with DI setup:
var services = new ServiceCollection();
services.AddDevSweepServices(outputFormat, autoConfirm);
var provider = services.BuildServiceProvider();
var analyzeUseCase = provider.GetRequiredService<IAnalyzeUseCase>();
// Execute command...AOT Verification
- Verify
dotnet publish -c Release -r osx-arm64succeeds - Check for AOT warnings (trim analysis)
- Verify binary runs:
./devsweep --help - Test published binary size (~10-15MB target)
- Verify cold start time (<100ms)
Tests Required
In tests/Infrastructure/Cli/Composition/ServiceRegistrationTests.cs:
- All services resolve correctly
- Output formatter strategy selection
- Interaction strategy selection
- Module registry contains all modules
Definition of Done
- ServiceRegistration complete
- Program.cs entry point working
- All services registered and resolvable
- AOT compilation succeeds without warnings
- Published binary tested and functional
- Tests verify DI container configuration
Reactions are currently unavailable