|
| 1 | +# Integrate TimeWarp.Nuru.DevCli shared endpoints |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +Replace custom `clean`, `check-version`, and `self-install` endpoint implementations with shared endpoints from the `TimeWarp.Nuru.DevCli` NuGet package. This reduces code duplication across TimeWarp repositories and ensures consistent behavior. |
| 6 | + |
| 7 | +## Checklist |
| 8 | + |
| 9 | +- [ ] Add `TimeWarp.Nuru.DevCli` package version to `Directory.Packages.props` |
| 10 | +- [ ] Add `<PackageReference Include="TimeWarp.Nuru.DevCli" />` to `tools/dev-cli/Directory.Build.props` |
| 11 | +- [ ] Update `tools/dev-cli/dev.cs` to register Amuru services in `ConfigureServices()` |
| 12 | +- [ ] Delete `tools/dev-cli/endpoints/clean.cs` (replaced by shared) |
| 13 | +- [ ] Delete `tools/dev-cli/endpoints/check-version.cs` (replaced by shared) |
| 14 | +- [ ] Delete `tools/dev-cli/endpoints/self-install.cs` (replaced by shared) |
| 15 | +- [ ] Run `./bin/dev self-install` to rebuild the CLI |
| 16 | +- [ ] Verify `./bin/dev clean` works |
| 17 | +- [ ] Verify `./bin/dev check-version` works |
| 18 | +- [ ] Verify `./bin/dev self-install` works |
| 19 | + |
| 20 | +## Notes |
| 21 | + |
| 22 | +### Service Registration |
| 23 | + |
| 24 | +The shared endpoints require these services from TimeWarp.Amuru: |
| 25 | +- `IRepoCleanService` / `RepoCleanService` - comprehensive cleaning (bin/obj directories) |
| 26 | +- `IRepoCheckVersionService` / `RepoCheckVersionService` - version checking with multiple strategies |
| 27 | +- `IRepoConfigService` / `RepoConfigService` - per-repo config defaults |
| 28 | + |
| 29 | +Register in `dev.cs`: |
| 30 | +```csharp |
| 31 | +NuruApp app = NuruApp.CreateBuilder() |
| 32 | + .WithDescription("Development CLI for timewarp-terminal") |
| 33 | + .ConfigureServices(services => |
| 34 | + { |
| 35 | + services.AddSingleton<IRepoCleanService, RepoCleanService>(); |
| 36 | + services.AddSingleton<IRepoCheckVersionService, RepoCheckVersionService>(); |
| 37 | + services.AddSingleton<IRepoConfigService, RepoConfigService>(); |
| 38 | + }) |
| 39 | + .DiscoverEndpoints() |
| 40 | + .Build(); |
| 41 | +``` |
| 42 | + |
| 43 | +### Source-Gen DI |
| 44 | + |
| 45 | +Nuru's source-gen DI handles services registered via `ConfigureServices()`. No `UseMicrosoftDependencyInjection()` needed. |
| 46 | + |
| 47 | +### repo.yaml (Optional) |
| 48 | + |
| 49 | +Can create `.timewarp/repo.yaml` for check-version defaults: |
| 50 | +```yaml |
| 51 | +check-version: |
| 52 | + strategy: nuget-search |
| 53 | + packages: TimeWarp.Terminal |
| 54 | +``` |
| 55 | +
|
| 56 | +This is optional - can pass `--strategy nuget-search --package TimeWarp.Terminal` on command line instead. |
| 57 | + |
| 58 | +### Shared vs Custom Endpoints |
| 59 | + |
| 60 | +| Endpoint | Shared Package | Notes | |
| 61 | +|----------|---------------|-------| |
| 62 | +| `clean` | Yes | Uses `IRepoCleanService` | |
| 63 | +| `check-version` | Yes | Uses `IRepoCheckVersionService`, `IRepoConfigService` | |
| 64 | +| `self-install` | Yes | Standalone (no service deps) | |
| 65 | +| `build` | No | Keep custom | |
| 66 | +| `test` | No | Keep custom | |
| 67 | +| `verify-samples` | No | Keep custom | |
| 68 | +| `workflow` | No | Keep custom (orchestrates other commands) | |
0 commit comments