diff --git a/README.md b/README.md index 69af983d4e8..aa5ea5a5434 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ public class PublishModule : Module protected override async Task ExecuteAsync(IModuleContext context, CancellationToken cancellationToken) { // This is real C#. Set a breakpoint. Inspect variables. Debug locally. - return await context.DotNet().PublishAsync(new DotNetPublishOptions + return await context.Tools.DotNet.PublishAsync(new DotNetPublishOptions { ProjectSolution = "src/MyApp/MyApp.csproj", Configuration = "Release", @@ -77,7 +77,7 @@ public class BuildModule : Module { protected override async Task ExecuteAsync(IModuleContext context, CancellationToken cancellationToken) { - await context.DotNet().BuildAsync( + await context.Tools.DotNet.BuildAsync( new DotNetBuildOptions { ProjectSolution = "MyApp.csproj" }, cancellationToken: cancellationToken); return new BuildInfo { Version = "1.0.0", OutputPath = "bin/Release" }; diff --git a/README_Template.md b/README_Template.md index 4557bd4aea6..e015f18974c 100644 --- a/README_Template.md +++ b/README_Template.md @@ -31,7 +31,7 @@ public class PublishModule : Module protected override async Task ExecuteAsync(IModuleContext context, CancellationToken cancellationToken) { // This is real C#. Set a breakpoint. Inspect variables. Debug locally. - return await context.DotNet().PublishAsync(new DotNetPublishOptions + return await context.Tools.DotNet.PublishAsync(new DotNetPublishOptions { ProjectSolution = "src/MyApp/MyApp.csproj", Configuration = "Release", @@ -77,7 +77,7 @@ public class BuildModule : Module { protected override async Task ExecuteAsync(IModuleContext context, CancellationToken cancellationToken) { - await context.DotNet().BuildAsync( + await context.Tools.DotNet.BuildAsync( new DotNetBuildOptions { ProjectSolution = "MyApp.csproj" }, cancellationToken: cancellationToken); return new BuildInfo { Version = "1.0.0", OutputPath = "bin/Release" }; diff --git a/docs/docs/distributed/capabilities.md b/docs/docs/distributed/capabilities.md index 0390ebfa225..9e5ab0c113e 100644 --- a/docs/docs/distributed/capabilities.md +++ b/docs/docs/distributed/capabilities.md @@ -60,7 +60,7 @@ public class DockerBuildModule : Module IModuleContext context, CancellationToken cancellationToken) { // Only executes on workers that advertise "docker" - await context.Docker().BuildAsync(new()); + await context.Tools.Docker.BuildAsync(new()); return "built"; } } diff --git a/docs/docs/distributed/getting-started.md b/docs/docs/distributed/getting-started.md index 15d726084ba..f32c7f29439 100644 --- a/docs/docs/distributed/getting-started.md +++ b/docs/docs/distributed/getting-started.md @@ -147,7 +147,7 @@ public class RestoreModule : Module protected override async Task ExecuteAsync( IModuleContext context, CancellationToken cancellationToken) { - await context.DotNet().RestoreAsync(new()); + await context.Tools.DotNet.RestoreAsync(new()); return "restored"; } } @@ -158,7 +158,7 @@ public class BuildModule : Module protected override async Task ExecuteAsync( IModuleContext context, CancellationToken cancellationToken) { - await context.DotNet().BuildAsync(new()); + await context.Tools.DotNet.BuildAsync(new()); return "built"; } } @@ -169,7 +169,7 @@ public class TestModule : Module protected override async Task ExecuteAsync( IModuleContext context, CancellationToken cancellationToken) { - await context.DotNet().TestAsync(new()); + await context.Tools.DotNet.TestAsync(new()); return "tested"; } } diff --git a/docs/docs/distributed/github-actions.md b/docs/docs/distributed/github-actions.md index 6aeb81c34ba..4c86bf97fee 100644 --- a/docs/docs/distributed/github-actions.md +++ b/docs/docs/distributed/github-actions.md @@ -113,7 +113,7 @@ public class RestoreModule : Module protected override async Task ExecuteAsync( IModuleContext context, CancellationToken cancellationToken) { - await context.DotNet().RestoreAsync(new()); + await context.Tools.DotNet.RestoreAsync(new()); return "restored"; } } @@ -125,8 +125,8 @@ public class LinuxBuildModule : Module protected override async Task ExecuteAsync( IModuleContext context, CancellationToken cancellationToken) { - await context.DotNet().BuildAsync(new()); - await context.DotNet().TestAsync(new()); + await context.Tools.DotNet.BuildAsync(new()); + await context.Tools.DotNet.TestAsync(new()); return "linux-ok"; } } @@ -138,8 +138,8 @@ public class WindowsBuildModule : Module protected override async Task ExecuteAsync( IModuleContext context, CancellationToken cancellationToken) { - await context.DotNet().BuildAsync(new()); - await context.DotNet().TestAsync(new()); + await context.Tools.DotNet.BuildAsync(new()); + await context.Tools.DotNet.TestAsync(new()); return "windows-ok"; } } @@ -151,8 +151,8 @@ public class MacBuildModule : Module protected override async Task ExecuteAsync( IModuleContext context, CancellationToken cancellationToken) { - await context.DotNet().BuildAsync(new()); - await context.DotNet().TestAsync(new()); + await context.Tools.DotNet.BuildAsync(new()); + await context.Tools.DotNet.TestAsync(new()); return "macos-ok"; } } diff --git a/docs/docs/examples/azure-example.md b/docs/docs/examples/azure-example.md index bea9c6a4880..1b8b76ec38d 100644 --- a/docs/docs/examples/azure-example.md +++ b/docs/docs/examples/azure-example.md @@ -20,7 +20,7 @@ public class ProvisionUserAssignedIdentityModule : Module ExecuteAsync(IModuleContext context, CancellationToken cancellationToken) { - var userAssignedIdentityProvisionResponse = await context.Azure().Provisioner.Security.UserAssignedIdentity( + var userAssignedIdentityProvisionResponse = await context.Tools.Azure.Provisioner.Security.UserAssignedIdentity( new AzureResourceIdentifier("MySubscription", "MyResourceGroup", "MyUserIdentity"), new UserAssignedIdentityData(AzureLocation.UKSouth) ); @@ -37,7 +37,7 @@ public class ProvisionBlobStorageAccountModule : Module { protected override async Task ExecuteAsync(IModuleContext context, CancellationToken cancellationToken) { - var blobStorageAccountProvisionResponse = await context.Azure().Provisioner.Storage.StorageAccount( + var blobStorageAccountProvisionResponse = await context.Tools.Azure.Provisioner.Storage.StorageAccount( new AzureResourceIdentifier("MySubscription", "MyResourceGroup", "MyStorage"), new StorageAccountCreateOrUpdateContent(new StorageSku(StorageSkuName.StandardGrs), StorageKind.BlobStorage, AzureLocation.UKSouth) ); @@ -57,7 +57,7 @@ public class ProvisionBlobStorageContainerModule : Module { var blobStorageAccount = await context.GetModule(); - var blobContainerProvisionResponse = await context.Azure().Provisioner.Storage.BlobContainer( + var blobContainerProvisionResponse = await context.Tools.Azure.Provisioner.Storage.BlobContainer( blobStorageAccount.ValueOrDefault!.Id, "MyContainer", new BlobContainerData() @@ -81,7 +81,7 @@ public class AssignAccessToBlobStorageModule : Module var storageAccount = await context.GetModule(); - var roleAssignmentResource = await context.Azure().Provisioner.Security.RoleAssignment( + var roleAssignmentResource = await context.Tools.Azure.Provisioner.Security.RoleAssignment( storageAccount.ValueOrDefault!.Id, new RoleAssignmentCreateOrUpdateContent(WellKnownRoleDefinitions.BlobStorageOwnerDefinitionId, userAssignedIdentity.ValueOrDefault!.Data.PrincipalId!.Value) ); @@ -106,7 +106,7 @@ public class ProvisionAzureFunction : Module var storageAccount = await context.GetModule(); var blobContainer = await context.GetModule(); - var functionProvisionResponse = await context.Azure().Provisioner.Compute.WebSite( + var functionProvisionResponse = await context.Tools.Azure.Provisioner.Compute.WebSite( new AzureResourceIdentifier("MySubscription", "MyResourceGroup", "MyFunction"), new WebSiteData(AzureLocation.UKSouth) { diff --git a/docs/docs/examples/dotnet-test-build-publish.md b/docs/docs/examples/dotnet-test-build-publish.md index 05ecda38c0b..75597813acf 100644 --- a/docs/docs/examples/dotnet-test-build-publish.md +++ b/docs/docs/examples/dotnet-test-build-publish.md @@ -13,7 +13,7 @@ public class NugetVersionGeneratorModule : Module { protected override async Task ExecuteAsync(IModuleContext context, CancellationToken cancellationToken) { - var gitVersionInformation = await context.Git().Versioning.GetGitVersioningInformation(); + var gitVersionInformation = await context.Tools.Git.Versioning.GetGitVersioningInformation(); return gitVersionInformation.FullSemVer; } } @@ -28,7 +28,7 @@ public class PackProjectsModule : Module { var packageVersion = await context.GetModule(); - var repositoryInfo = await context.Git().Information.GetInfoAsync() + var repositoryInfo = await context.Tools.Git.Information.GetInfoAsync() ?? throw new InvalidOperationException("Git repository information is unavailable."); var projects = repositoryInfo.Root .GetFiles(x => @@ -37,7 +37,7 @@ public class PackProjectsModule : Module return await projects .ToAsyncProcessorBuilder() - .SelectAsync(async projectFile => await context.DotNet().PackAsync(new DotNetPackOptions + .SelectAsync(async projectFile => await context.Tools.DotNet.PackAsync(new DotNetPackOptions { TargetPath = projectFile.Path, IncludeSource = true, @@ -61,13 +61,13 @@ public class RunUnitTestsModule : Module { protected override async Task ExecuteAsync(IModuleContext context, CancellationToken cancellationToken) { - var repositoryInfo = await context.Git().Information.GetInfoAsync() + var repositoryInfo = await context.Tools.Git.Information.GetInfoAsync() ?? throw new InvalidOperationException("Git repository information is unavailable."); return await repositoryInfo.Root .GetFiles(file => file.Path.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase) && file.Path.Contains("UnitTests", StringComparison.OrdinalIgnoreCase)) .ToAsyncProcessorBuilder() - .SelectAsync(async unitTestProjectFile => await context.DotNet().TestAsync(new DotNetTestOptions + .SelectAsync(async unitTestProjectFile => await context.Tools.DotNet.TestAsync(new DotNetTestOptions { TargetPath = unitTestProjectFile.Path, Collect = "XPlat Code Coverage", @@ -96,7 +96,7 @@ public class UploadPackagesToNugetModule : Module { ArgumentNullException.ThrowIfNull(_nugetSettings.Value.ApiKey); - var repositoryInfo = await context.Git().Information.GetInfoAsync() + var repositoryInfo = await context.Tools.Git.Information.GetInfoAsync() ?? throw new InvalidOperationException("Git repository information is unavailable."); var packages = repositoryInfo.Root .GetFiles(x => diff --git a/docs/docs/fundamentals.md b/docs/docs/fundamentals.md index 0e2596a42f1..e73ec654184 100644 --- a/docs/docs/fundamentals.md +++ b/docs/docs/fundamentals.md @@ -26,6 +26,23 @@ The building blocks of your pipelines are called Modules. Modules can be as big Modules can retrieve other modules and access information from them. +## Tool Integrations + +Installed tool integrations are available from the discoverable `context.Tools` surface: + +```csharp +await context.Tools.DotNet.BuildAsync(new DotNetBuildOptions +{ + ProjectSolution = "MyApp.sln" +}, cancellationToken: cancellationToken); +``` + +`context.Tools.DotNet` is the canonical C# 14 API and does not require an integration +extension namespace import. The older `context.DotNet()` extension method remains available +as a compatibility fallback for projects using an earlier C# language version. When a project +declares an integration accessor in its own compilation, source-generator warning `MPG0008` +identifies that fallback on earlier language versions. + ## Strong Typing Modules are strongly typed, so we can return clear, concrete objects, and other modules have direct access to those strong objects, without any need for casting or guessing the type, or guessing keys from a dictionary. diff --git a/docs/docs/how-to/generate-private-cli-integration.md b/docs/docs/how-to/generate-private-cli-integration.md index 5918fcde4f3..e14ec087bac 100644 --- a/docs/docs/how-to/generate-private-cli-integration.md +++ b/docs/docs/how-to/generate-private-cli-integration.md @@ -170,7 +170,7 @@ or `GetType`, because instance-member lookup would hide the generated property. `context.Tools.*` is the preferred discoverable API; the original extension method remains available for compatibility. Generated tool properties use C# 14 extension members. On older language versions, registration metadata still generates and `MPG0008` explains why -the optional `Tools` property was skipped. +the optional `Tools` property was skipped and names the `context.X()` compatibility accessor. Referencing the `ModularPipelines` package includes the source generator as an analyzer. The generator emits immutable assembly registration metadata, which each pipeline consumes diff --git a/docs/docs/how-to/logging.md b/docs/docs/how-to/logging.md index 4dd153de1d2..4839bd834f8 100644 --- a/docs/docs/how-to/logging.md +++ b/docs/docs/how-to/logging.md @@ -51,7 +51,7 @@ When you execute CLI commands (e.g., `dotnet build`, `docker run`), ModularPipel ### Per-Command Configuration ```csharp -await context.DotNet().BuildAsync( +await context.Tools.DotNet.BuildAsync( new DotNetBuildOptions { Configuration = "Release" }, new CommandExecutionOptions { diff --git a/docs/docs/how-to/source-generator-diagnostics.md b/docs/docs/how-to/source-generator-diagnostics.md index ceeded6a685..ccfa9a03db8 100644 --- a/docs/docs/how-to/source-generator-diagnostics.md +++ b/docs/docs/how-to/source-generator-diagnostics.md @@ -72,7 +72,8 @@ accessible and non-generic. Until fixed, Modular Pipelines uses runtime reflecti A tool accessor cannot generate a discoverable `context.Tools` property because the consuming project uses a language version older than C# 14. Registration -metadata still generates. Use C# 14 or preview to enable the property. +metadata still generates. Use C# 14 or preview to enable the property, or use +the diagnostic's `context.X()` compatibility accessor. **Severity:** Warning diff --git a/docs/docs/how-to/sub-modules.md b/docs/docs/how-to/sub-modules.md index ec124160358..95c9c3090fa 100644 --- a/docs/docs/how-to/sub-modules.md +++ b/docs/docs/how-to/sub-modules.md @@ -26,7 +26,7 @@ public class PackProjectsModule : Module { var packageVersion = await context.GetModule(); - var repositoryInfo = await context.Git().Information.GetInfoAsync() + var repositoryInfo = await context.Tools.Git.Information.GetInfoAsync() ?? throw new InvalidOperationException("Git repository information is unavailable."); var projects = repositoryInfo.Root .GetFiles(x => @@ -40,7 +40,7 @@ public class PackProjectsModule : Module { foreach (var project in projects) { - yield return await context.SubModule(project.Name, () => context.DotNet().PackAsync(new DotNetPackOptions + yield return await context.SubModule(project.Name, () => context.Tools.DotNet.PackAsync(new DotNetPackOptions { TargetPath = project, Configuration = Configuration.Release, diff --git a/docs/docs/mp-packages/ansible.md b/docs/docs/mp-packages/ansible.md index 83b61c3e0a0..eda4b4ca10c 100644 --- a/docs/docs/mp-packages/ansible.md +++ b/docs/docs/mp-packages/ansible.md @@ -17,10 +17,9 @@ The `ansible` executable must be installed and available on `PATH` when the pipe ## Run an ad-hoc command ```csharp -using ModularPipelines.Ansible.Extensions; using ModularPipelines.Ansible.Options; -var result = await context.Ansible().ExecuteAsync( +var result = await context.Tools.Ansible.ExecuteAsync( new AnsibleExecuteOptions("webservers") { Inventory = ["hosts.ini"], diff --git a/docs/docs/mp-packages/argocd.md b/docs/docs/mp-packages/argocd.md index 571fe0f0b8d..cccbe39b520 100644 --- a/docs/docs/mp-packages/argocd.md +++ b/docs/docs/mp-packages/argocd.md @@ -20,10 +20,9 @@ The `argocd` executable must be installed and available on `PATH` when the pipel ```csharp using ModularPipelines.ArgoCd.Enums; -using ModularPipelines.ArgoCd.Extensions; using ModularPipelines.ArgoCd.Options; -var result = await context.ArgoCd().App.GetAsync( +var result = await context.Tools.ArgoCd.App.GetAsync( new ArgoCdAppGetOptions("guestbook") { AppNamespace = "argocd", @@ -42,7 +41,7 @@ argocd app get guestbook --app-namespace=argocd --output=json --refresh ## Create ApplicationSets ```csharp -var result = await context.ArgoCd().ApplicationSet.CreateAsync( +var result = await context.Tools.ArgoCd.ApplicationSet.CreateAsync( new ArgoCdApplicationSetCreateOptions(["apps.yaml", "more-apps.yaml"]) { DryRun = true, diff --git a/docs/docs/mp-packages/azure-pipelines.md b/docs/docs/mp-packages/azure-pipelines.md index ec210422ea4..c6064ac6e6a 100644 --- a/docs/docs/mp-packages/azure-pipelines.md +++ b/docs/docs/mp-packages/azure-pipelines.md @@ -14,14 +14,13 @@ dotnet add package ModularPipelines.Azure.Pipelines ## Context entry points -Import `ModularPipelines.Azure.Pipelines.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.AzurePipeline()` +- `context.Tools.AzurePipeline` ## Module example ```csharp -using ModularPipelines.Azure.Pipelines.Extensions; public class UseAzurePipelineModule : SyncModule { @@ -29,7 +28,7 @@ public class UseAzurePipelineModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var azurePipeline = context.AzurePipeline(); + var azurePipeline = context.Tools.AzurePipeline; // Call the integration's strongly typed operations here. context.Logger.LogInformation("AzurePipeline integration is ready"); diff --git a/docs/docs/mp-packages/azure.md b/docs/docs/mp-packages/azure.md index 3c3af3a42a9..c8629f15645 100644 --- a/docs/docs/mp-packages/azure.md +++ b/docs/docs/mp-packages/azure.md @@ -16,10 +16,10 @@ Required command-line tool: `az`. It must be installed and available on `PATH` w ## Context entry points -Import `ModularPipelines.Azure.Extensions`, then use these services from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Azure()` -- `context.Az()` +- `context.Tools.Azure` +- `context.Tools.Az` ## Module example @@ -27,7 +27,6 @@ Import `ModularPipelines.Azure.Extensions`, then use these services from a modul using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Azure.Extensions; using ModularPipelines.Azure.Options; public class UseAzureModule : Module @@ -36,7 +35,7 @@ public class UseAzureModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Az().Account.ListAsync( + return await context.Tools.Az.Account.ListAsync( new AzAccountListOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/buildah.md b/docs/docs/mp-packages/buildah.md index 839ac89aa4f..601aebe3a5c 100644 --- a/docs/docs/mp-packages/buildah.md +++ b/docs/docs/mp-packages/buildah.md @@ -16,14 +16,13 @@ Required command-line tool: `buildah`. It must be installed and available on `PA ## Context entry points -Import `ModularPipelines.Buildah.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Buildah()` +- `context.Tools.Buildah` ## Module example ```csharp -using ModularPipelines.Buildah.Extensions; public class UseBuildahModule : SyncModule { @@ -31,7 +30,7 @@ public class UseBuildahModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var buildah = context.Buildah(); + var buildah = context.Tools.Buildah; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Buildah integration is ready"); diff --git a/docs/docs/mp-packages/chocolatey.md b/docs/docs/mp-packages/chocolatey.md index e0ab26f4236..6930b5ebdd4 100644 --- a/docs/docs/mp-packages/chocolatey.md +++ b/docs/docs/mp-packages/chocolatey.md @@ -16,14 +16,13 @@ Required command-line tool: `choco`. It must be installed and available on `PATH ## Context entry points -Import `ModularPipelines.Chocolatey.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Choco()` +- `context.Tools.Choco` ## Module example ```csharp -using ModularPipelines.Chocolatey.Extensions; public class UseChocoModule : SyncModule { @@ -31,7 +30,7 @@ public class UseChocoModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var choco = context.Choco(); + var choco = context.Tools.Choco; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Choco integration is ready"); diff --git a/docs/docs/mp-packages/cli/ansible.md b/docs/docs/mp-packages/cli/ansible.md index c9f7ea05286..e42230d314d 100644 --- a/docs/docs/mp-packages/cli/ansible.md +++ b/docs/docs/mp-packages/cli/ansible.md @@ -13,7 +13,7 @@ title: ansible CLI reference dotnet add package ModularPipelines.Ansible ``` -Import `ModularPipelines.Ansible.Extensions`, then resolve the service with `context.Ansible()`. +Resolve the service with `context.Tools.Ansible`. For projects older than C# 14, import `ModularPipelines.Ansible.Extensions` and use the `context.Ansible()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Ansible.Extensions`, then resolve the service with `con using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Ansible.Extensions; using ModularPipelines.Ansible.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Ansible().ExecuteAsync( + return await context.Tools.Ansible.ExecuteAsync( new AnsibleExecuteOptions("value"), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/argocd.md b/docs/docs/mp-packages/cli/argocd.md index 58312279c12..e9f54731246 100644 --- a/docs/docs/mp-packages/cli/argocd.md +++ b/docs/docs/mp-packages/cli/argocd.md @@ -13,7 +13,7 @@ title: argocd CLI reference dotnet add package ModularPipelines.ArgoCd ``` -Import `ModularPipelines.ArgoCd.Extensions`, then resolve the service with `context.ArgoCd()`. +Resolve the service with `context.Tools.ArgoCd`. For projects older than C# 14, import `ModularPipelines.ArgoCd.Extensions` and use the `context.ArgoCd()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.ArgoCd.Extensions`, then resolve the service with `cont using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.ArgoCd.Extensions; using ModularPipelines.ArgoCd.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.ArgoCd().ConfigureAsync( + return await context.Tools.ArgoCd.ConfigureAsync( new ArgoCdConfigureOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/az.md b/docs/docs/mp-packages/cli/az.md index 8edd3042cac..435db7b6490 100644 --- a/docs/docs/mp-packages/cli/az.md +++ b/docs/docs/mp-packages/cli/az.md @@ -13,7 +13,7 @@ title: az CLI reference dotnet add package ModularPipelines.Azure ``` -Import `ModularPipelines.Azure.Extensions`, then resolve the service with `context.Az()`. +Resolve the service with `context.Tools.Az`. For projects older than C# 14, import `ModularPipelines.Azure.Extensions` and use the `context.Az()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Azure.Extensions`, then resolve the service with `conte using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Azure.Extensions; using ModularPipelines.Azure.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Az().Account.ListAsync( + return await context.Tools.Az.Account.ListAsync( new AzAccountListOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/buildah.md b/docs/docs/mp-packages/cli/buildah.md index b922bcd818b..eceec4ca29f 100644 --- a/docs/docs/mp-packages/cli/buildah.md +++ b/docs/docs/mp-packages/cli/buildah.md @@ -13,7 +13,7 @@ title: buildah CLI reference dotnet add package ModularPipelines.Buildah ``` -Import `ModularPipelines.Buildah.Extensions`, then resolve the service with `context.Buildah()`. +Resolve the service with `context.Tools.Buildah`. For projects older than C# 14, import `ModularPipelines.Buildah.Extensions` and use the `context.Buildah()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Buildah.Extensions`, then resolve the service with `con using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Buildah.Extensions; using ModularPipelines.Buildah.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Buildah().AddAsync( + return await context.Tools.Buildah.AddAsync( new BuildahAddOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/cargo.md b/docs/docs/mp-packages/cli/cargo.md index ef3e44d2a0c..af34c4f4a8e 100644 --- a/docs/docs/mp-packages/cli/cargo.md +++ b/docs/docs/mp-packages/cli/cargo.md @@ -13,7 +13,7 @@ title: cargo CLI reference dotnet add package ModularPipelines.Rust ``` -Import `ModularPipelines.Rust.Extensions`, then resolve the service with `context.Cargo()`. +Resolve the service with `context.Tools.Cargo`. For projects older than C# 14, import `ModularPipelines.Rust.Extensions` and use the `context.Cargo()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Rust.Extensions`, then resolve the service with `contex using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Rust.Extensions; using ModularPipelines.Rust.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Cargo().CheckAsync( + return await context.Tools.Cargo.CheckAsync( new CargoCheckOptions { Quiet = true, diff --git a/docs/docs/mp-packages/cli/choco.md b/docs/docs/mp-packages/cli/choco.md index 75779b6ddd2..3f822218ac0 100644 --- a/docs/docs/mp-packages/cli/choco.md +++ b/docs/docs/mp-packages/cli/choco.md @@ -13,7 +13,7 @@ title: choco CLI reference dotnet add package ModularPipelines.Chocolatey ``` -Import `ModularPipelines.Chocolatey.Extensions`, then resolve the service with `context.Choco()`. +Resolve the service with `context.Tools.Choco`. For projects older than C# 14, import `ModularPipelines.Chocolatey.Extensions` and use the `context.Choco()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Chocolatey.Extensions`, then resolve the service with ` using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Chocolatey.Extensions; using ModularPipelines.Chocolatey.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Choco().ApikeyAsync( + return await context.Tools.Choco.ApikeyAsync( new ChocoApikeyOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/flux.md b/docs/docs/mp-packages/cli/flux.md index 159693dc6f5..2bedcfec865 100644 --- a/docs/docs/mp-packages/cli/flux.md +++ b/docs/docs/mp-packages/cli/flux.md @@ -13,7 +13,7 @@ title: flux CLI reference dotnet add package ModularPipelines.Flux ``` -Import `ModularPipelines.Flux.Extensions`, then resolve the service with `context.Flux()`. +Resolve the service with `context.Tools.Flux`. For projects older than C# 14, import `ModularPipelines.Flux.Extensions` and use the `context.Flux()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Flux.Extensions`, then resolve the service with `contex using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Flux.Extensions; using ModularPipelines.Flux.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Flux().CheckAsync( + return await context.Tools.Flux.CheckAsync( new FluxCheckOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/flyway.md b/docs/docs/mp-packages/cli/flyway.md index bc8ecccd090..849faec7a89 100644 --- a/docs/docs/mp-packages/cli/flyway.md +++ b/docs/docs/mp-packages/cli/flyway.md @@ -13,7 +13,7 @@ title: flyway CLI reference dotnet add package ModularPipelines.Flyway ``` -Import `ModularPipelines.Flyway.Extensions`, then resolve the service with `context.Flyway()`. +Resolve the service with `context.Tools.Flyway`. For projects older than C# 14, import `ModularPipelines.Flyway.Extensions` and use the `context.Flyway()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Flyway.Extensions`, then resolve the service with `cont using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Flyway.Extensions; using ModularPipelines.Flyway.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Flyway().InfoAsync( + return await context.Tools.Flyway.InfoAsync( new FlywayInfoOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/gcloud.md b/docs/docs/mp-packages/cli/gcloud.md index 8a44e18fa86..4c4a876f4b6 100644 --- a/docs/docs/mp-packages/cli/gcloud.md +++ b/docs/docs/mp-packages/cli/gcloud.md @@ -13,7 +13,7 @@ title: gcloud CLI reference dotnet add package ModularPipelines.Google ``` -Import `ModularPipelines.Google.Extensions`, then resolve the service with `context.Gcloud()`. +Resolve the service with `context.Tools.Gcloud`. For projects older than C# 14, import `ModularPipelines.Google.Extensions` and use the `context.Gcloud()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Google.Extensions`, then resolve the service with `cont using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Google.Extensions; using ModularPipelines.Google.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Gcloud().InfoAsync( + return await context.Tools.Gcloud.InfoAsync( new GcloudInfoOptions { Anonymize = true, diff --git a/docs/docs/mp-packages/cli/gh.md b/docs/docs/mp-packages/cli/gh.md index 27cc0e5e7b6..0e3c3f3c01e 100644 --- a/docs/docs/mp-packages/cli/gh.md +++ b/docs/docs/mp-packages/cli/gh.md @@ -13,7 +13,7 @@ title: gh CLI reference dotnet add package ModularPipelines.GitHub ``` -Import `ModularPipelines.GitHub.Extensions`, then resolve the service with `context.Gh()`. +Resolve the service with `context.Tools.Gh`. For projects older than C# 14, import `ModularPipelines.GitHub.Extensions` and use the `context.Gh()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.GitHub.Extensions`, then resolve the service with `cont using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.GitHub.Extensions; using ModularPipelines.GitHub.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Gh().Config.ListAsync( + return await context.Tools.Gh.Config.ListAsync( new GhConfigListOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/go.md b/docs/docs/mp-packages/cli/go.md index c0c23c61523..a747a304b2d 100644 --- a/docs/docs/mp-packages/cli/go.md +++ b/docs/docs/mp-packages/cli/go.md @@ -13,7 +13,7 @@ title: go CLI reference dotnet add package ModularPipelines.Go ``` -Import `ModularPipelines.Go.Extensions`, then resolve the service with `context.Go()`. +Resolve the service with `context.Tools.Go`. For projects older than C# 14, import `ModularPipelines.Go.Extensions` and use the `context.Go()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Go.Extensions`, then resolve the service with `context. using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Go.Extensions; using ModularPipelines.Go.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Go().VetAsync( + return await context.Tools.Go.VetAsync( new GoVetOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/gradle.md b/docs/docs/mp-packages/cli/gradle.md index 5eb8a0a14e8..7bc3f937796 100644 --- a/docs/docs/mp-packages/cli/gradle.md +++ b/docs/docs/mp-packages/cli/gradle.md @@ -13,7 +13,7 @@ title: gradle CLI reference dotnet add package ModularPipelines.Java ``` -Import `ModularPipelines.Java.Extensions`, then resolve the service with `context.Gradle()`. +Resolve the service with `context.Tools.Gradle`. For projects older than C# 14, import `ModularPipelines.Java.Extensions` and use the `context.Gradle()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Java.Extensions`, then resolve the service with `contex using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Java.Extensions; using ModularPipelines.Java.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Gradle().ExecuteAsync( + return await context.Tools.Gradle.ExecuteAsync( new GradleExecuteOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/grype.md b/docs/docs/mp-packages/cli/grype.md index ba1a03cc889..637a9e4b60e 100644 --- a/docs/docs/mp-packages/cli/grype.md +++ b/docs/docs/mp-packages/cli/grype.md @@ -13,7 +13,7 @@ title: grype CLI reference dotnet add package ModularPipelines.Grype ``` -Import `ModularPipelines.Grype.Extensions`, then resolve the service with `context.Grype()`. +Resolve the service with `context.Tools.Grype`. For projects older than C# 14, import `ModularPipelines.Grype.Extensions` and use the `context.Grype()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Grype.Extensions`, then resolve the service with `conte using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Grype.Extensions; using ModularPipelines.Grype.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Grype().ExplainAsync( + return await context.Tools.Grype.ExplainAsync( new GrypeExplainOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/hadolint.md b/docs/docs/mp-packages/cli/hadolint.md index ffaf2e152e0..981847fa888 100644 --- a/docs/docs/mp-packages/cli/hadolint.md +++ b/docs/docs/mp-packages/cli/hadolint.md @@ -13,7 +13,7 @@ title: hadolint CLI reference dotnet add package ModularPipelines.Hadolint ``` -Import `ModularPipelines.Hadolint.Extensions`, then resolve the service with `context.Hadolint()`. +Resolve the service with `context.Tools.Hadolint`. For projects older than C# 14, import `ModularPipelines.Hadolint.Extensions` and use the `context.Hadolint()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Hadolint.Extensions`, then resolve the service with `co using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Hadolint.Extensions; using ModularPipelines.Hadolint.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Hadolint().ExecuteAsync( + return await context.Tools.Hadolint.ExecuteAsync( new HadolintExecuteOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/helm.md b/docs/docs/mp-packages/cli/helm.md index 26f49bce6a8..937503c8af9 100644 --- a/docs/docs/mp-packages/cli/helm.md +++ b/docs/docs/mp-packages/cli/helm.md @@ -13,7 +13,7 @@ title: helm CLI reference dotnet add package ModularPipelines.Helm ``` -Import `ModularPipelines.Helm.Extensions`, then resolve the service with `context.Helm()`. +Resolve the service with `context.Tools.Helm`. For projects older than C# 14, import `ModularPipelines.Helm.Extensions` and use the `context.Helm()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Helm.Extensions`, then resolve the service with `contex using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Helm.Extensions; using ModularPipelines.Helm.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Helm().EnvAsync( + return await context.Tools.Helm.EnvAsync( new HelmEnvOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/jq.md b/docs/docs/mp-packages/cli/jq.md index fc40ca92b7f..bba4da5c913 100644 --- a/docs/docs/mp-packages/cli/jq.md +++ b/docs/docs/mp-packages/cli/jq.md @@ -13,7 +13,7 @@ title: jq CLI reference dotnet add package ModularPipelines.Jq ``` -Import `ModularPipelines.Jq.Extensions`, then resolve the service with `context.Jq()`. +Resolve the service with `context.Tools.Jq`. For projects older than C# 14, import `ModularPipelines.Jq.Extensions` and use the `context.Jq()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Jq.Extensions`, then resolve the service with `context. using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Jq.Extensions; using ModularPipelines.Jq.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Jq().ExecuteAsync( + return await context.Tools.Jq.ExecuteAsync( new JqExecuteOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/kind.md b/docs/docs/mp-packages/cli/kind.md index 18af20b9329..f9335221581 100644 --- a/docs/docs/mp-packages/cli/kind.md +++ b/docs/docs/mp-packages/cli/kind.md @@ -13,16 +13,15 @@ title: kind CLI reference dotnet add package ModularPipelines.Kind ``` -Import `ModularPipelines.Kind.Extensions`, then resolve the service with `context.Kind()`. +Resolve the service with `context.Tools.Kind`. For projects older than C# 14, import `ModularPipelines.Kind.Extensions` and use the `context.Kind()` extension method as a compatibility fallback. ## Module example Resolve the service in a module, then select a generated sub-domain and command from the table below: ```csharp -using ModularPipelines.Kind.Extensions; -var kind = context.Kind(); +var kind = context.Tools.Kind; ``` ## Commands diff --git a/docs/docs/mp-packages/cli/kubectl.md b/docs/docs/mp-packages/cli/kubectl.md index fe0e5c69e6a..05142d6aa5b 100644 --- a/docs/docs/mp-packages/cli/kubectl.md +++ b/docs/docs/mp-packages/cli/kubectl.md @@ -13,7 +13,7 @@ title: kubectl CLI reference dotnet add package ModularPipelines.Kubernetes ``` -Import `ModularPipelines.Kubernetes.Extensions`, then resolve the service with `context.Kubernetes()`. +Resolve the service with `context.Tools.Kubernetes`. For projects older than C# 14, import `ModularPipelines.Kubernetes.Extensions` and use the `context.Kubernetes()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Kubernetes.Extensions`, then resolve the service with ` using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Kubernetes.Extensions; using ModularPipelines.Kubernetes.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Kubernetes().Config.ViewAsync( + return await context.Tools.Kubernetes.Config.ViewAsync( new KubernetesConfigViewOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/kustomize.md b/docs/docs/mp-packages/cli/kustomize.md index 468664680d6..d78fe98ca7f 100644 --- a/docs/docs/mp-packages/cli/kustomize.md +++ b/docs/docs/mp-packages/cli/kustomize.md @@ -13,7 +13,7 @@ title: kustomize CLI reference dotnet add package ModularPipelines.Kubernetes ``` -Import `ModularPipelines.Kubernetes.Extensions`, then resolve the service with `context.Kustomize()`. +Resolve the service with `context.Tools.Kustomize`. For projects older than C# 14, import `ModularPipelines.Kubernetes.Extensions` and use the `context.Kustomize()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Kubernetes.Extensions`, then resolve the service with ` using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Kubernetes.Extensions; using ModularPipelines.Kubernetes.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Kustomize().BuildAsync( + return await context.Tools.Kustomize.BuildAsync( new KustomizeBuildOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/liquibase.md b/docs/docs/mp-packages/cli/liquibase.md index e2417e605bc..1a9fc803905 100644 --- a/docs/docs/mp-packages/cli/liquibase.md +++ b/docs/docs/mp-packages/cli/liquibase.md @@ -13,7 +13,7 @@ title: liquibase CLI reference dotnet add package ModularPipelines.Liquibase ``` -Import `ModularPipelines.Liquibase.Extensions`, then resolve the service with `context.Liquibase()`. +Resolve the service with `context.Tools.Liquibase`. For projects older than C# 14, import `ModularPipelines.Liquibase.Extensions` and use the `context.Liquibase()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Liquibase.Extensions`, then resolve the service with `c using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Liquibase.Extensions; using ModularPipelines.Liquibase.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Liquibase().CalculateChecksumAsync( + return await context.Tools.Liquibase.CalculateChecksumAsync( new LiquibaseCalculateChecksumOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/mvn.md b/docs/docs/mp-packages/cli/mvn.md index 3e0d59669f2..c66c0293b09 100644 --- a/docs/docs/mp-packages/cli/mvn.md +++ b/docs/docs/mp-packages/cli/mvn.md @@ -13,7 +13,7 @@ title: mvn CLI reference dotnet add package ModularPipelines.Java ``` -Import `ModularPipelines.Java.Extensions`, then resolve the service with `context.Maven()`. +Resolve the service with `context.Tools.Maven`. For projects older than C# 14, import `ModularPipelines.Java.Extensions` and use the `context.Maven()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Java.Extensions`, then resolve the service with `contex using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Java.Extensions; using ModularPipelines.Java.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Maven().ExecuteAsync( + return await context.Tools.Maven.ExecuteAsync( new MavenExecuteOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/nbgv.md b/docs/docs/mp-packages/cli/nbgv.md index becf89c4026..baf0e71488e 100644 --- a/docs/docs/mp-packages/cli/nbgv.md +++ b/docs/docs/mp-packages/cli/nbgv.md @@ -23,7 +23,7 @@ Install the nbgv .NET tool globally or in a tool path available on PATH. dotnet add package ModularPipelines.NerdbankGitVersioning ``` -Import `ModularPipelines.NerdbankGitVersioning.Extensions`, then resolve the service with `context.Nbgv()`. +Resolve the service with `context.Tools.Nbgv`. For projects older than C# 14, import `ModularPipelines.NerdbankGitVersioning.Extensions` and use the `context.Nbgv()` extension method as a compatibility fallback. ## Module example @@ -31,7 +31,6 @@ Import `ModularPipelines.NerdbankGitVersioning.Extensions`, then resolve the ser using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.NerdbankGitVersioning.Extensions; using ModularPipelines.NerdbankGitVersioning.Options; public class RunCommandModule : Module @@ -40,7 +39,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Nbgv().GetVersionAsync( + return await context.Tools.Nbgv.GetVersionAsync( new NbgvGetVersionOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/newman.md b/docs/docs/mp-packages/cli/newman.md index 0c9dc8aa843..fecbe803d71 100644 --- a/docs/docs/mp-packages/cli/newman.md +++ b/docs/docs/mp-packages/cli/newman.md @@ -13,7 +13,7 @@ title: newman CLI reference dotnet add package ModularPipelines.Newman ``` -Import `ModularPipelines.Newman.Extensions`, then resolve the service with `context.Newman()`. +Resolve the service with `context.Tools.Newman`. For projects older than C# 14, import `ModularPipelines.Newman.Extensions` and use the `context.Newman()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Newman.Extensions`, then resolve the service with `cont using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Newman.Extensions; using ModularPipelines.Newman.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Newman().UrlAsync( + return await context.Tools.Newman.UrlAsync( new NewmanUrlOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/packer.md b/docs/docs/mp-packages/cli/packer.md index 70155a66b09..d2b5443d376 100644 --- a/docs/docs/mp-packages/cli/packer.md +++ b/docs/docs/mp-packages/cli/packer.md @@ -13,7 +13,7 @@ title: packer CLI reference dotnet add package ModularPipelines.Packer ``` -Import `ModularPipelines.Packer.Extensions`, then resolve the service with `context.Packer()`. +Resolve the service with `context.Tools.Packer`. For projects older than C# 14, import `ModularPipelines.Packer.Extensions` and use the `context.Packer()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Packer.Extensions`, then resolve the service with `cont using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Packer.Extensions; using ModularPipelines.Packer.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Packer().ConsoleAsync( + return await context.Tools.Packer.ConsoleAsync( new PackerConsoleOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/pip.md b/docs/docs/mp-packages/cli/pip.md index c196415c010..3e94253a8be 100644 --- a/docs/docs/mp-packages/cli/pip.md +++ b/docs/docs/mp-packages/cli/pip.md @@ -13,7 +13,7 @@ title: pip CLI reference dotnet add package ModularPipelines.Python ``` -Import `ModularPipelines.Python.Extensions`, then resolve the service with `context.Pip()`. +Resolve the service with `context.Tools.Pip`. For projects older than C# 14, import `ModularPipelines.Python.Extensions` and use the `context.Pip()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Python.Extensions`, then resolve the service with `cont using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Python.Extensions; using ModularPipelines.Python.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Pip().FreezeAsync( + return await context.Tools.Pip.FreezeAsync( new PipFreezeOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/pnpm.md b/docs/docs/mp-packages/cli/pnpm.md index 6f4c5153e82..1c883f82f68 100644 --- a/docs/docs/mp-packages/cli/pnpm.md +++ b/docs/docs/mp-packages/cli/pnpm.md @@ -13,7 +13,7 @@ title: pnpm CLI reference dotnet add package ModularPipelines.Node ``` -Import `ModularPipelines.Node.Extensions`, then resolve the service with `context.Pnpm()`. +Resolve the service with `context.Tools.Pnpm`. For projects older than C# 14, import `ModularPipelines.Node.Extensions` and use the `context.Pnpm()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Node.Extensions`, then resolve the service with `contex using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Node.Extensions; using ModularPipelines.Node.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Pnpm().AuditAsync( + return await context.Tools.Pnpm.AuditAsync( new PnpmAuditOptions { AuditLevel = "high", diff --git a/docs/docs/mp-packages/cli/podman.md b/docs/docs/mp-packages/cli/podman.md index 5705d0f415a..edc9a1fdf7a 100644 --- a/docs/docs/mp-packages/cli/podman.md +++ b/docs/docs/mp-packages/cli/podman.md @@ -13,7 +13,7 @@ title: podman CLI reference dotnet add package ModularPipelines.Podman ``` -Import `ModularPipelines.Podman.Extensions`, then resolve the service with `context.Podman()`. +Resolve the service with `context.Tools.Podman`. For projects older than C# 14, import `ModularPipelines.Podman.Extensions` and use the `context.Podman()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Podman.Extensions`, then resolve the service with `cont using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Podman.Extensions; using ModularPipelines.Podman.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Podman().AttachAsync( + return await context.Tools.Podman.AttachAsync( new PodmanAttachOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/shellcheck.md b/docs/docs/mp-packages/cli/shellcheck.md index 70608717123..aec153074d8 100644 --- a/docs/docs/mp-packages/cli/shellcheck.md +++ b/docs/docs/mp-packages/cli/shellcheck.md @@ -13,7 +13,7 @@ title: shellcheck CLI reference dotnet add package ModularPipelines.Shellcheck ``` -Import `ModularPipelines.Shellcheck.Extensions`, then resolve the service with `context.Shellcheck()`. +Resolve the service with `context.Tools.Shellcheck`. For projects older than C# 14, import `ModularPipelines.Shellcheck.Extensions` and use the `context.Shellcheck()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Shellcheck.Extensions`, then resolve the service with ` using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Shellcheck.Extensions; using ModularPipelines.Shellcheck.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Shellcheck().ExecuteAsync( + return await context.Tools.Shellcheck.ExecuteAsync( new ShellcheckExecuteOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/skopeo.md b/docs/docs/mp-packages/cli/skopeo.md index e78a4058366..4d7fca32ad6 100644 --- a/docs/docs/mp-packages/cli/skopeo.md +++ b/docs/docs/mp-packages/cli/skopeo.md @@ -13,7 +13,7 @@ title: skopeo CLI reference dotnet add package ModularPipelines.Skopeo ``` -Import `ModularPipelines.Skopeo.Extensions`, then resolve the service with `context.Skopeo()`. +Resolve the service with `context.Tools.Skopeo`. For projects older than C# 14, import `ModularPipelines.Skopeo.Extensions` and use the `context.Skopeo()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Skopeo.Extensions`, then resolve the service with `cont using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Skopeo.Extensions; using ModularPipelines.Skopeo.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Skopeo().GenerateSigstoreKeyAsync( + return await context.Tools.Skopeo.GenerateSigstoreKeyAsync( new SkopeoGenerateSigstoreKeyOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/snyk.md b/docs/docs/mp-packages/cli/snyk.md index 5b0e47243cc..fb4de2486d1 100644 --- a/docs/docs/mp-packages/cli/snyk.md +++ b/docs/docs/mp-packages/cli/snyk.md @@ -13,7 +13,7 @@ title: snyk CLI reference dotnet add package ModularPipelines.Snyk ``` -Import `ModularPipelines.Snyk.Extensions`, then resolve the service with `context.Snyk()`. +Resolve the service with `context.Tools.Snyk`. For projects older than C# 14, import `ModularPipelines.Snyk.Extensions` and use the `context.Snyk()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Snyk.Extensions`, then resolve the service with `contex using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Snyk.Extensions; using ModularPipelines.Snyk.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Snyk().AuthAsync( + return await context.Tools.Snyk.AuthAsync( new SnykAuthOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/sonar-scanner.md b/docs/docs/mp-packages/cli/sonar-scanner.md index 5fed4fcf016..088c98818b8 100644 --- a/docs/docs/mp-packages/cli/sonar-scanner.md +++ b/docs/docs/mp-packages/cli/sonar-scanner.md @@ -13,7 +13,7 @@ title: sonar-scanner CLI reference dotnet add package ModularPipelines.SonarScanner ``` -Import `ModularPipelines.SonarScanner.Extensions`, then resolve the service with `context.SonarScanner()`. +Resolve the service with `context.Tools.SonarScanner`. For projects older than C# 14, import `ModularPipelines.SonarScanner.Extensions` and use the `context.SonarScanner()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.SonarScanner.Extensions`, then resolve the service with using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.SonarScanner.Extensions; using ModularPipelines.SonarScanner.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.SonarScanner().ExecuteAsync( + return await context.Tools.SonarScanner.ExecuteAsync( new SonarScannerExecuteOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/syft.md b/docs/docs/mp-packages/cli/syft.md index 98fff9d8763..576417441e7 100644 --- a/docs/docs/mp-packages/cli/syft.md +++ b/docs/docs/mp-packages/cli/syft.md @@ -13,7 +13,7 @@ title: syft CLI reference dotnet add package ModularPipelines.Syft ``` -Import `ModularPipelines.Syft.Extensions`, then resolve the service with `context.Syft()`. +Resolve the service with `context.Tools.Syft`. For projects older than C# 14, import `ModularPipelines.Syft.Extensions` and use the `context.Syft()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Syft.Extensions`, then resolve the service with `contex using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Syft.Extensions; using ModularPipelines.Syft.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Syft().AttestAsync( + return await context.Tools.Syft.AttestAsync( new SyftAttestOptions("value"), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/terraform.md b/docs/docs/mp-packages/cli/terraform.md index e993ebdefb7..55b47d15d8f 100644 --- a/docs/docs/mp-packages/cli/terraform.md +++ b/docs/docs/mp-packages/cli/terraform.md @@ -13,7 +13,7 @@ title: terraform CLI reference dotnet add package ModularPipelines.Terraform ``` -Import `ModularPipelines.Terraform.Extensions`, then resolve the service with `context.Terraform()`. +Resolve the service with `context.Tools.Terraform`. For projects older than C# 14, import `ModularPipelines.Terraform.Extensions` and use the `context.Terraform()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Terraform.Extensions`, then resolve the service with `c using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Terraform.Extensions; using ModularPipelines.Terraform.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Terraform().ValidateAsync( + return await context.Tools.Terraform.ValidateAsync( new TerraformValidateOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/trivy.md b/docs/docs/mp-packages/cli/trivy.md index fe2a766a466..aa9c61cced4 100644 --- a/docs/docs/mp-packages/cli/trivy.md +++ b/docs/docs/mp-packages/cli/trivy.md @@ -13,7 +13,7 @@ title: trivy CLI reference dotnet add package ModularPipelines.Trivy ``` -Import `ModularPipelines.Trivy.Extensions`, then resolve the service with `context.Trivy()`. +Resolve the service with `context.Tools.Trivy`. For projects older than C# 14, import `ModularPipelines.Trivy.Extensions` and use the `context.Trivy()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Trivy.Extensions`, then resolve the service with `conte using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Trivy.Extensions; using ModularPipelines.Trivy.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Trivy().CleanAsync( + return await context.Tools.Trivy.CleanAsync( new TrivyCleanOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/vault.md b/docs/docs/mp-packages/cli/vault.md index 4a504204fbe..3853b4d147b 100644 --- a/docs/docs/mp-packages/cli/vault.md +++ b/docs/docs/mp-packages/cli/vault.md @@ -13,7 +13,7 @@ title: vault CLI reference dotnet add package ModularPipelines.Vault ``` -Import `ModularPipelines.Vault.Extensions`, then resolve the service with `context.Vault()`. +Resolve the service with `context.Tools.Vault`. For projects older than C# 14, import `ModularPipelines.Vault.Extensions` and use the `context.Vault()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Vault.Extensions`, then resolve the service with `conte using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Vault.Extensions; using ModularPipelines.Vault.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Vault().DeleteAsync( + return await context.Tools.Vault.DeleteAsync( new VaultDeleteOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/winget.md b/docs/docs/mp-packages/cli/winget.md index 342ae6120e9..dae10a72aa0 100644 --- a/docs/docs/mp-packages/cli/winget.md +++ b/docs/docs/mp-packages/cli/winget.md @@ -13,7 +13,7 @@ title: winget CLI reference dotnet add package ModularPipelines.WinGet ``` -Import `ModularPipelines.WinGet.Extensions`, then resolve the service with `context.Winget()`. +Resolve the service with `context.Tools.Winget`. For projects older than C# 14, import `ModularPipelines.WinGet.Extensions` and use the `context.Winget()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.WinGet.Extensions`, then resolve the service with `cont using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.WinGet.Extensions; using ModularPipelines.WinGet.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Winget().InstallAsync( + return await context.Tools.Winget.InstallAsync( new WingetInstallOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cli/yq.md b/docs/docs/mp-packages/cli/yq.md index 5b7359d4e7d..acf90b5cbd0 100644 --- a/docs/docs/mp-packages/cli/yq.md +++ b/docs/docs/mp-packages/cli/yq.md @@ -13,7 +13,7 @@ title: yq CLI reference dotnet add package ModularPipelines.Yq ``` -Import `ModularPipelines.Yq.Extensions`, then resolve the service with `context.Yq()`. +Resolve the service with `context.Tools.Yq`. For projects older than C# 14, import `ModularPipelines.Yq.Extensions` and use the `context.Yq()` extension method as a compatibility fallback. ## Module example @@ -21,7 +21,6 @@ Import `ModularPipelines.Yq.Extensions`, then resolve the service with `context. using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Yq.Extensions; using ModularPipelines.Yq.Options; public class RunCommandModule : Module @@ -30,7 +29,7 @@ public class RunCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Yq().EvalAllAsync( + return await context.Tools.Yq.EvalAllAsync( new YqEvalAllOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/cmd.md b/docs/docs/mp-packages/cmd.md index c1880377dc1..020471f7f37 100644 --- a/docs/docs/mp-packages/cmd.md +++ b/docs/docs/mp-packages/cmd.md @@ -16,14 +16,13 @@ Required command-line tool: `cmd`. It must be installed and available on `PATH` ## Context entry points -Import `ModularPipelines.Cmd.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Cmd()` +- `context.Tools.Cmd` ## Module example ```csharp -using ModularPipelines.Cmd.Extensions; public class UseCmdModule : SyncModule { @@ -31,7 +30,7 @@ public class UseCmdModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var cmd = context.Cmd(); + var cmd = context.Tools.Cmd; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Cmd integration is ready"); diff --git a/docs/docs/mp-packages/cosign.md b/docs/docs/mp-packages/cosign.md index fb37e5794df..a49afc65fe1 100644 --- a/docs/docs/mp-packages/cosign.md +++ b/docs/docs/mp-packages/cosign.md @@ -18,10 +18,9 @@ The `cosign` executable must be installed and available on `PATH` when the pipel ## Sign container images ```csharp -using ModularPipelines.Cosign.Extensions; using ModularPipelines.Cosign.Options; -var result = await context.Cosign().SignAsync( +var result = await context.Tools.Cosign.SignAsync( new CosignSignOptions(["registry.example/app@sha256:..."]) { Key = "cosign.key", @@ -40,7 +39,7 @@ cosign sign registry.example/app@sha256:... --annotations=team=platform --key=co ## Verify container images ```csharp -var result = await context.Cosign().VerifyAsync( +var result = await context.Tools.Cosign.VerifyAsync( new CosignVerifyOptions(["registry.example/app@sha256:..."]) { Key = "cosign.pub", diff --git a/docs/docs/mp-packages/docker.md b/docs/docs/mp-packages/docker.md index f0ed8e36004..ec53e2aaad3 100644 --- a/docs/docs/mp-packages/docker.md +++ b/docs/docs/mp-packages/docker.md @@ -16,9 +16,9 @@ Required command-line tool: `docker`. It must be installed and available on `PAT ## Context entry points -Import `ModularPipelines.Docker.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Docker()` +- `context.Tools.Docker` ## Module example @@ -26,7 +26,6 @@ Import `ModularPipelines.Docker.Extensions`, then use this service from a module using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Docker.Extensions; using ModularPipelines.Docker.Options; public class UseDockerModule : Module @@ -35,7 +34,7 @@ public class UseDockerModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Docker().InfoAsync( + return await context.Tools.Docker.InfoAsync( new DockerInfoOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/dotnet.md b/docs/docs/mp-packages/dotnet.md index 873a00a270f..125c0eef507 100644 --- a/docs/docs/mp-packages/dotnet.md +++ b/docs/docs/mp-packages/dotnet.md @@ -16,10 +16,10 @@ Required command-line tool: `dotnet`. It must be installed and available on `PAT ## Context entry points -Import `ModularPipelines.DotNet.Extensions`, then use these services from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.DotNet()` -- `context.Trx()` +- `context.Tools.DotNet` +- `context.Tools.Trx` ## Module example @@ -27,7 +27,6 @@ Import `ModularPipelines.DotNet.Extensions`, then use these services from a modu using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.DotNet.Extensions; using ModularPipelines.DotNet.Options; public class UseDotNetModule : Module @@ -36,7 +35,7 @@ public class UseDotNetModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.DotNet().Workload.ListAsync( + return await context.Tools.DotNet.Workload.ListAsync( new DotNetWorkloadListOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/eksctl.md b/docs/docs/mp-packages/eksctl.md index f352a593c49..3907975e5ed 100644 --- a/docs/docs/mp-packages/eksctl.md +++ b/docs/docs/mp-packages/eksctl.md @@ -18,10 +18,9 @@ The `eksctl` executable must be installed and available on `PATH` when the pipel ## Create a cluster ```csharp -using ModularPipelines.Eksctl.Extensions; using ModularPipelines.Eksctl.Options; -var result = await context.Eksctl().Create.ClusterAsync( +var result = await context.Tools.Eksctl.Create.ClusterAsync( new EksctlCreateClusterOptions { Name = "production", @@ -44,7 +43,7 @@ eksctl create cluster --name=production --region=eu-west-2 --zones=eu-west-2a -- ```csharp using ModularPipelines.Eksctl.Enums; -var result = await context.Eksctl().Utils.UpdateClusterLoggingAsync( +var result = await context.Tools.Eksctl.Utils.UpdateClusterLoggingAsync( new EksctlUtilsUpdateClusterLoggingOptions { Cluster = "production", diff --git a/docs/docs/mp-packages/email.md b/docs/docs/mp-packages/email.md index 1ca8dcdb12a..6c457e76c2b 100644 --- a/docs/docs/mp-packages/email.md +++ b/docs/docs/mp-packages/email.md @@ -14,14 +14,13 @@ dotnet add package ModularPipelines.Email ## Context entry points -Import `ModularPipelines.Email.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Email()` +- `context.Tools.Email` ## Module example ```csharp -using ModularPipelines.Email.Extensions; public class UseEmailModule : SyncModule { @@ -29,7 +28,7 @@ public class UseEmailModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var email = context.Email(); + var email = context.Tools.Email; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Email integration is ready"); diff --git a/docs/docs/mp-packages/flux.md b/docs/docs/mp-packages/flux.md index 3a6f866e9cd..9438abfa376 100644 --- a/docs/docs/mp-packages/flux.md +++ b/docs/docs/mp-packages/flux.md @@ -16,14 +16,13 @@ Required command-line tool: `flux`. It must be installed and available on `PATH` ## Context entry points -Import `ModularPipelines.Flux.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Flux()` +- `context.Tools.Flux` ## Module example ```csharp -using ModularPipelines.Flux.Extensions; public class UseFluxModule : SyncModule { @@ -31,7 +30,7 @@ public class UseFluxModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var flux = context.Flux(); + var flux = context.Tools.Flux; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Flux integration is ready"); diff --git a/docs/docs/mp-packages/flyway.md b/docs/docs/mp-packages/flyway.md index 75f5e01c744..9b35c4e6ebe 100644 --- a/docs/docs/mp-packages/flyway.md +++ b/docs/docs/mp-packages/flyway.md @@ -16,14 +16,13 @@ Required command-line tool: `flyway`. It must be installed and available on `PAT ## Context entry points -Import `ModularPipelines.Flyway.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Flyway()` +- `context.Tools.Flyway` ## Module example ```csharp -using ModularPipelines.Flyway.Extensions; public class UseFlywayModule : SyncModule { @@ -31,7 +30,7 @@ public class UseFlywayModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var flyway = context.Flyway(); + var flyway = context.Tools.Flyway; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Flyway integration is ready"); diff --git a/docs/docs/mp-packages/ftp.md b/docs/docs/mp-packages/ftp.md index 5c5902aaf44..52d3af8c456 100644 --- a/docs/docs/mp-packages/ftp.md +++ b/docs/docs/mp-packages/ftp.md @@ -14,14 +14,13 @@ dotnet add package ModularPipelines.Ftp ## Context entry points -Import `ModularPipelines.Ftp.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Ftp()` +- `context.Tools.Ftp` ## Module example ```csharp -using ModularPipelines.Ftp.Extensions; public class UseFtpModule : SyncModule { @@ -29,7 +28,7 @@ public class UseFtpModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var ftp = context.Ftp(); + var ftp = context.Tools.Ftp; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Ftp integration is ready"); diff --git a/docs/docs/mp-packages/git.md b/docs/docs/mp-packages/git.md index 20bd75ab8d7..317d5830439 100644 --- a/docs/docs/mp-packages/git.md +++ b/docs/docs/mp-packages/git.md @@ -16,9 +16,9 @@ Required command-line tool: `git`. It must be installed and available on `PATH` ## Context entry points -Import `ModularPipelines.Git.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Git()` +- `context.Tools.Git` ## Module example @@ -26,7 +26,6 @@ Import `ModularPipelines.Git.Extensions`, then use this service from a module: using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Git.Extensions; using ModularPipelines.Git.Options; public class UseGitModule : Module @@ -35,7 +34,7 @@ public class UseGitModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Git().Commands.WorkingTree.StatusAsync( + return await context.Tools.Git.Commands.WorkingTree.StatusAsync( new GitStatusOptions { Short = true, diff --git a/docs/docs/mp-packages/github.md b/docs/docs/mp-packages/github.md index bf719f9fab9..91e98ea198f 100644 --- a/docs/docs/mp-packages/github.md +++ b/docs/docs/mp-packages/github.md @@ -25,8 +25,8 @@ public class GitHubModule : Module IModuleContext context, CancellationToken cancellationToken) { - var info = context.GitHub().RepositoryInfo; - var user = await context.GitHub().Client.User.Get(info.Owner); + var info = context.Tools.GitHub.RepositoryInfo; + var user = await context.Tools.GitHub.Client.User.Get(info.Owner); context.Logger.LogInformation("User location: {Location}", user.Location); @@ -43,11 +43,11 @@ This feature is really important because many services in the GitHub API need de ```cs // Let's delete GitHub release with Id 12 -var info = context.GitHub().RepositoryInfo; +var info = context.Tools.GitHub.RepositoryInfo; var owner = info.Owner; var repo = info.RepositoryName; -await context.GitHub().Client.Repository.Release.Delete(owner, repo, 12); +await context.Tools.GitHub.Client.Repository.Release.Delete(owner, repo, 12); ``` ## Client Auth diff --git a/docs/docs/mp-packages/go.md b/docs/docs/mp-packages/go.md index 70fe7c62fb5..60eaf0929a2 100644 --- a/docs/docs/mp-packages/go.md +++ b/docs/docs/mp-packages/go.md @@ -16,9 +16,9 @@ Required command-line tool: `go`. It must be installed and available on `PATH` w ## Context entry points -Import `ModularPipelines.Go.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Go()` +- `context.Tools.Go` ## Module example @@ -26,7 +26,6 @@ Import `ModularPipelines.Go.Extensions`, then use this service from a module: using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Go.Extensions; using ModularPipelines.Go.Options; public class UseGoModule : Module @@ -35,7 +34,7 @@ public class UseGoModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Go().VetAsync( + return await context.Tools.Go.VetAsync( new GoVetOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/google.md b/docs/docs/mp-packages/google.md index e91affc0c20..381391af3c4 100644 --- a/docs/docs/mp-packages/google.md +++ b/docs/docs/mp-packages/google.md @@ -16,9 +16,9 @@ Required command-line tool: `gcloud`. It must be installed and available on `PAT ## Context entry points -Import `ModularPipelines.Google.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Gcloud()` +- `context.Tools.Gcloud` ## Module example @@ -26,7 +26,6 @@ Import `ModularPipelines.Google.Extensions`, then use this service from a module using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Google.Extensions; using ModularPipelines.Google.Options; public class UseGcloudModule : Module @@ -35,7 +34,7 @@ public class UseGcloudModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Gcloud().InfoAsync( + return await context.Tools.Gcloud.InfoAsync( new GcloudInfoOptions { Anonymize = true, diff --git a/docs/docs/mp-packages/grype.md b/docs/docs/mp-packages/grype.md index 323db429fbf..e22b702c660 100644 --- a/docs/docs/mp-packages/grype.md +++ b/docs/docs/mp-packages/grype.md @@ -16,14 +16,13 @@ Required command-line tool: `grype`. It must be installed and available on `PATH ## Context entry points -Import `ModularPipelines.Grype.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Grype()` +- `context.Tools.Grype` ## Module example ```csharp -using ModularPipelines.Grype.Extensions; public class UseGrypeModule : SyncModule { @@ -31,7 +30,7 @@ public class UseGrypeModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var grype = context.Grype(); + var grype = context.Tools.Grype; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Grype integration is ready"); diff --git a/docs/docs/mp-packages/hadolint.md b/docs/docs/mp-packages/hadolint.md index 0876cd063ad..66d4d918c79 100644 --- a/docs/docs/mp-packages/hadolint.md +++ b/docs/docs/mp-packages/hadolint.md @@ -18,10 +18,9 @@ The `hadolint` executable must be installed and available on `PATH` when the pip ```csharp using ModularPipelines.Hadolint.Enums; -using ModularPipelines.Hadolint.Extensions; using ModularPipelines.Hadolint.Options; -var result = await context.Hadolint().ExecuteAsync( +var result = await context.Tools.Hadolint.ExecuteAsync( new HadolintExecuteOptions { Dockerfiles = ["Dockerfile", "build/Dockerfile"], diff --git a/docs/docs/mp-packages/helm.md b/docs/docs/mp-packages/helm.md index 6e95695945a..3a75556ee80 100644 --- a/docs/docs/mp-packages/helm.md +++ b/docs/docs/mp-packages/helm.md @@ -16,9 +16,9 @@ Required command-line tool: `helm`. It must be installed and available on `PATH` ## Context entry points -Import `ModularPipelines.Helm.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Helm()` +- `context.Tools.Helm` ## Module example @@ -26,7 +26,6 @@ Import `ModularPipelines.Helm.Extensions`, then use this service from a module: using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Helm.Extensions; using ModularPipelines.Helm.Options; public class UseHelmModule : Module @@ -35,7 +34,7 @@ public class UseHelmModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Helm().EnvAsync( + return await context.Tools.Helm.EnvAsync( new HelmEnvOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/homebrew.md b/docs/docs/mp-packages/homebrew.md index 7022656c857..0cdc7a136fe 100644 --- a/docs/docs/mp-packages/homebrew.md +++ b/docs/docs/mp-packages/homebrew.md @@ -16,9 +16,9 @@ Required command-line tool: `brew`. It must be installed and available on `PATH` ## Context entry points -Import `ModularPipelines.Homebrew.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Brew()` +- `context.Tools.Brew` ## Module example @@ -26,7 +26,6 @@ Import `ModularPipelines.Homebrew.Extensions`, then use this service from a modu using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Homebrew.Extensions; using ModularPipelines.Homebrew.Options; public class UseBrewModule : Module @@ -35,7 +34,7 @@ public class UseBrewModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Brew().ListAsync( + return await context.Tools.Brew.ListAsync( new BrewListOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/java.md b/docs/docs/mp-packages/java.md index 5d1e0cb5c57..d00fee3bf98 100644 --- a/docs/docs/mp-packages/java.md +++ b/docs/docs/mp-packages/java.md @@ -18,11 +18,10 @@ The `mvn` or `gradle` executable must be installed and available on `PATH` when ```csharp using ModularPipelines.Java.Enums; -using ModularPipelines.Java.Extensions; using ModularPipelines.Java.Options; using ModularPipelines.Models; -var result = await context.Maven().ExecuteAsync( +var result = await context.Tools.Maven.ExecuteAsync( new MavenExecuteOptions { BatchMode = true, @@ -42,7 +41,7 @@ mvn --batch-mode --color never --define skipTests=true clean verify ## Gradle ```csharp -var result = await context.Gradle().ExecuteAsync( +var result = await context.Tools.Gradle.ExecuteAsync( new GradleExecuteOptions { Console = GradleConsole.Plain, diff --git a/docs/docs/mp-packages/jq.md b/docs/docs/mp-packages/jq.md index 59c208d6dd1..b61ce077ae4 100644 --- a/docs/docs/mp-packages/jq.md +++ b/docs/docs/mp-packages/jq.md @@ -17,11 +17,10 @@ The `jq` executable must be installed and available on `PATH` when the pipeline ## Process JSON ```csharp -using ModularPipelines.Jq.Extensions; using ModularPipelines.Jq.Options; using ModularPipelines.Models; -var result = await context.Jq().ExecuteAsync( +var result = await context.Tools.Jq.ExecuteAsync( new JqExecuteOptions { RawOutput = true, diff --git a/docs/docs/mp-packages/kind.md b/docs/docs/mp-packages/kind.md index 80fa878029f..c4c89593a4e 100644 --- a/docs/docs/mp-packages/kind.md +++ b/docs/docs/mp-packages/kind.md @@ -16,14 +16,13 @@ Required command-line tool: `kind`. It must be installed and available on `PATH` ## Context entry points -Import `ModularPipelines.Kind.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Kind()` +- `context.Tools.Kind` ## Module example ```csharp -using ModularPipelines.Kind.Extensions; public class UseKindModule : SyncModule { @@ -31,7 +30,7 @@ public class UseKindModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var kind = context.Kind(); + var kind = context.Tools.Kind; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Kind integration is ready"); diff --git a/docs/docs/mp-packages/kubernetes.md b/docs/docs/mp-packages/kubernetes.md index 6670a132e98..3a6f8267fd2 100644 --- a/docs/docs/mp-packages/kubernetes.md +++ b/docs/docs/mp-packages/kubernetes.md @@ -16,10 +16,10 @@ Required command-line tools: `kubectl`, `kustomize`. They must be installed and ## Context entry points -Import `ModularPipelines.Kubernetes.Extensions`, then use these services from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Kubernetes()` -- `context.Kustomize()` +- `context.Tools.Kubernetes` +- `context.Tools.Kustomize` ## Module example @@ -27,7 +27,6 @@ Import `ModularPipelines.Kubernetes.Extensions`, then use these services from a using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Kubernetes.Extensions; using ModularPipelines.Kubernetes.Options; public class UseKubernetesModule : Module @@ -36,7 +35,7 @@ public class UseKubernetesModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Kubernetes().Config.ViewAsync( + return await context.Tools.Kubernetes.Config.ViewAsync( new KubernetesConfigViewOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/liquibase.md b/docs/docs/mp-packages/liquibase.md index c6a39f3c876..0235f0da918 100644 --- a/docs/docs/mp-packages/liquibase.md +++ b/docs/docs/mp-packages/liquibase.md @@ -10,7 +10,6 @@ Install the package and access Liquibase through the pipeline context: ```csharp using ModularPipelines.Liquibase.Enums; -using ModularPipelines.Liquibase.Extensions; using ModularPipelines.Liquibase.Options; using ModularPipelines.Models; @@ -20,7 +19,7 @@ public class UpdateDatabaseModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Liquibase().UpdateAsync( + return await context.Tools.Liquibase.UpdateAsync( new LiquibaseUpdateOptions { ChangelogFile = "db/changelog.xml", diff --git a/docs/docs/mp-packages/microsoft-teams.md b/docs/docs/mp-packages/microsoft-teams.md index 6ed599d4f60..c4654f37672 100644 --- a/docs/docs/mp-packages/microsoft-teams.md +++ b/docs/docs/mp-packages/microsoft-teams.md @@ -14,14 +14,13 @@ dotnet add package ModularPipelines.MicrosoftTeams ## Context entry points -Import `ModularPipelines.MicrosoftTeams.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.MicrosoftTeams()` +- `context.Tools.MicrosoftTeams` ## Module example ```csharp -using ModularPipelines.MicrosoftTeams.Extensions; public class UseMicrosoftTeamsModule : SyncModule { @@ -29,7 +28,7 @@ public class UseMicrosoftTeamsModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var microsoftTeams = context.MicrosoftTeams(); + var microsoftTeams = context.Tools.MicrosoftTeams; // Call the integration's strongly typed operations here. context.Logger.LogInformation("MicrosoftTeams integration is ready"); diff --git a/docs/docs/mp-packages/minikube.md b/docs/docs/mp-packages/minikube.md index 6dda6f35bc9..12be03f2f87 100644 --- a/docs/docs/mp-packages/minikube.md +++ b/docs/docs/mp-packages/minikube.md @@ -16,14 +16,13 @@ Required command-line tool: `minikube`. It must be installed and available on `P ## Context entry points -Import `ModularPipelines.Minikube.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Minikube()` +- `context.Tools.Minikube` ## Module example ```csharp -using ModularPipelines.Minikube.Extensions; public class UseMinikubeModule : SyncModule { @@ -31,7 +30,7 @@ public class UseMinikubeModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var minikube = context.Minikube(); + var minikube = context.Tools.Minikube; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Minikube integration is ready"); diff --git a/docs/docs/mp-packages/nerdbank-gitversioning.md b/docs/docs/mp-packages/nerdbank-gitversioning.md index e13cc26d8a2..fab4b925d4b 100644 --- a/docs/docs/mp-packages/nerdbank-gitversioning.md +++ b/docs/docs/mp-packages/nerdbank-gitversioning.md @@ -18,10 +18,9 @@ The `nbgv` executable must be available on `PATH` when the pipeline runs. ## Read version information ```csharp -using ModularPipelines.NerdbankGitVersioning.Extensions; using ModularPipelines.NerdbankGitVersioning.Options; -var result = await context.Nbgv().GetVersionAsync( +var result = await context.Tools.Nbgv.GetVersionAsync( new NbgvGetVersionOptions { Project = "src/MyProject", @@ -33,7 +32,7 @@ var result = await context.Nbgv().GetVersionAsync( ## Set cloud build variables ```csharp -var result = await context.Nbgv().CloudAsync( +var result = await context.Tools.Nbgv.CloudAsync( new NbgvCloudOptions { CommonVars = true, diff --git a/docs/docs/mp-packages/newman.md b/docs/docs/mp-packages/newman.md index 8cc4c306771..bffee568961 100644 --- a/docs/docs/mp-packages/newman.md +++ b/docs/docs/mp-packages/newman.md @@ -16,14 +16,13 @@ Required command-line tool: `newman`. It must be installed and available on `PAT ## Context entry points -Import `ModularPipelines.Newman.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Newman()` +- `context.Tools.Newman` ## Module example ```csharp -using ModularPipelines.Newman.Extensions; public class UseNewmanModule : SyncModule { @@ -31,7 +30,7 @@ public class UseNewmanModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var newman = context.Newman(); + var newman = context.Tools.Newman; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Newman integration is ready"); diff --git a/docs/docs/mp-packages/node.md b/docs/docs/mp-packages/node.md index ae3840b8c4a..6c47b15a36d 100644 --- a/docs/docs/mp-packages/node.md +++ b/docs/docs/mp-packages/node.md @@ -16,13 +16,13 @@ Required command-line tools: `node`, `npm`, `npx`, `nvm`, and `pnpm`. Install th ## Context entry points -Import `ModularPipelines.Node.Extensions`, then use these services from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Node()` -- `context.Node().Npm` -- `context.Node().Npx` -- `context.Node().Nvm` -- `context.Pnpm()` +- `context.Tools.Node` +- `context.Tools.Node.Npm` +- `context.Tools.Node.Npx` +- `context.Tools.Node.Nvm` +- `context.Tools.Pnpm` ## Module example @@ -30,7 +30,6 @@ Import `ModularPipelines.Node.Extensions`, then use these services from a module using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Node.Extensions; public class UseNodeModule : Module { @@ -38,7 +37,7 @@ public class UseNodeModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Node().VersionAsync(cancellationToken); + return await context.Tools.Node.VersionAsync(cancellationToken); } } ``` diff --git a/docs/docs/mp-packages/packer.md b/docs/docs/mp-packages/packer.md index ac9618d35c9..4a8d0ecddff 100644 --- a/docs/docs/mp-packages/packer.md +++ b/docs/docs/mp-packages/packer.md @@ -16,14 +16,13 @@ Required command-line tool: `packer`. It must be installed and available on `PAT ## Context entry points -Import `ModularPipelines.Packer.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Packer()` +- `context.Tools.Packer` ## Module example ```csharp -using ModularPipelines.Packer.Extensions; public class UsePackerModule : SyncModule { @@ -31,7 +30,7 @@ public class UsePackerModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var packer = context.Packer(); + var packer = context.Tools.Packer; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Packer integration is ready"); diff --git a/docs/docs/mp-packages/podman.md b/docs/docs/mp-packages/podman.md index 22759a09358..b818a6a4861 100644 --- a/docs/docs/mp-packages/podman.md +++ b/docs/docs/mp-packages/podman.md @@ -16,14 +16,13 @@ Required command-line tool: `podman`. It must be installed and available on `PAT ## Context entry points -Import `ModularPipelines.Podman.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Podman()` +- `context.Tools.Podman` ## Module example ```csharp -using ModularPipelines.Podman.Extensions; public class UsePodmanModule : SyncModule { @@ -31,7 +30,7 @@ public class UsePodmanModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var podman = context.Podman(); + var podman = context.Tools.Podman; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Podman integration is ready"); diff --git a/docs/docs/mp-packages/pulumi.md b/docs/docs/mp-packages/pulumi.md index a037c8d533c..a2c8751f213 100644 --- a/docs/docs/mp-packages/pulumi.md +++ b/docs/docs/mp-packages/pulumi.md @@ -16,14 +16,13 @@ Required command-line tool: `pulumi`. It must be installed and available on `PAT ## Context entry points -Import `ModularPipelines.Pulumi.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Pulumi()` +- `context.Tools.Pulumi` ## Module example ```csharp -using ModularPipelines.Pulumi.Extensions; public class UsePulumiModule : SyncModule { @@ -31,7 +30,7 @@ public class UsePulumiModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var pulumi = context.Pulumi(); + var pulumi = context.Tools.Pulumi; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Pulumi integration is ready"); diff --git a/docs/docs/mp-packages/python.md b/docs/docs/mp-packages/python.md index b0cd8cb86c6..412706ee718 100644 --- a/docs/docs/mp-packages/python.md +++ b/docs/docs/mp-packages/python.md @@ -16,9 +16,9 @@ Required command-line tool: `pip`. It must be installed and available on `PATH` ## Context entry points -Import `ModularPipelines.Python.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Pip()` +- `context.Tools.Pip` ## Module example @@ -26,7 +26,6 @@ Import `ModularPipelines.Python.Extensions`, then use this service from a module using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Python.Extensions; using ModularPipelines.Python.Options; public class UsePipModule : Module @@ -35,7 +34,7 @@ public class UsePipModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Pip().FreezeAsync( + return await context.Tools.Pip.FreezeAsync( new PipFreezeOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/rust.md b/docs/docs/mp-packages/rust.md index d8121c2cf50..7a29e53a5c3 100644 --- a/docs/docs/mp-packages/rust.md +++ b/docs/docs/mp-packages/rust.md @@ -16,9 +16,9 @@ Required command-line tool: `cargo`. It must be installed and available on `PATH ## Context entry points -Import `ModularPipelines.Rust.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Cargo()` +- `context.Tools.Cargo` ## Module example @@ -26,7 +26,6 @@ Import `ModularPipelines.Rust.Extensions`, then use this service from a module: using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Rust.Extensions; using ModularPipelines.Rust.Options; public class UseCargoModule : Module @@ -35,7 +34,7 @@ public class UseCargoModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Cargo().CheckAsync( + return await context.Tools.Cargo.CheckAsync( new CargoCheckOptions { Quiet = true, diff --git a/docs/docs/mp-packages/shellcheck.md b/docs/docs/mp-packages/shellcheck.md index ae5c236073d..7db00018d9f 100644 --- a/docs/docs/mp-packages/shellcheck.md +++ b/docs/docs/mp-packages/shellcheck.md @@ -16,7 +16,6 @@ Install the package and invoke ShellCheck through the pipeline context: ```csharp using ModularPipelines.Shellcheck.Enums; -using ModularPipelines.Shellcheck.Extensions; using ModularPipelines.Shellcheck.Options; public class CheckShellScriptsModule : Module @@ -25,7 +24,7 @@ public class CheckShellScriptsModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Shellcheck().ExecuteAsync( + return await context.Tools.Shellcheck.ExecuteAsync( new ShellcheckExecuteOptions { Files = ["scripts/build.sh", "scripts/deploy.sh"], diff --git a/docs/docs/mp-packages/skopeo.md b/docs/docs/mp-packages/skopeo.md index 4a395f32f61..9f117a087c2 100644 --- a/docs/docs/mp-packages/skopeo.md +++ b/docs/docs/mp-packages/skopeo.md @@ -16,14 +16,13 @@ Required command-line tool: `skopeo`. It must be installed and available on `PAT ## Context entry points -Import `ModularPipelines.Skopeo.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Skopeo()` +- `context.Tools.Skopeo` ## Module example ```csharp -using ModularPipelines.Skopeo.Extensions; public class UseSkopeoModule : SyncModule { @@ -31,7 +30,7 @@ public class UseSkopeoModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var skopeo = context.Skopeo(); + var skopeo = context.Tools.Skopeo; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Skopeo integration is ready"); diff --git a/docs/docs/mp-packages/slack.md b/docs/docs/mp-packages/slack.md index 4e4f62cd732..f47994d861b 100644 --- a/docs/docs/mp-packages/slack.md +++ b/docs/docs/mp-packages/slack.md @@ -14,14 +14,13 @@ dotnet add package ModularPipelines.Slack ## Context entry points -Import `ModularPipelines.Slack.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Slack()` +- `context.Tools.Slack` ## Module example ```csharp -using ModularPipelines.Slack.Extensions; public class UseSlackModule : SyncModule { @@ -29,7 +28,7 @@ public class UseSlackModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var slack = context.Slack(); + var slack = context.Tools.Slack; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Slack integration is ready"); diff --git a/docs/docs/mp-packages/snyk.md b/docs/docs/mp-packages/snyk.md index 2051afcbca4..10c38c0c95e 100644 --- a/docs/docs/mp-packages/snyk.md +++ b/docs/docs/mp-packages/snyk.md @@ -19,10 +19,9 @@ The `snyk` executable must be installed and available on `PATH` when the pipelin ```csharp using ModularPipelines.Snyk.Enums; -using ModularPipelines.Snyk.Extensions; using ModularPipelines.Snyk.Options; -var result = await context.Snyk().ContainerTestAsync( +var result = await context.Tools.Snyk.ContainerTestAsync( new SnykContainerTestOptions("alpine:3.20") { SeverityThreshold = SnykSeverityThreshold.High, diff --git a/docs/docs/mp-packages/sonar-scanner.md b/docs/docs/mp-packages/sonar-scanner.md index 5b55f6c8478..4ce3a9d0e62 100644 --- a/docs/docs/mp-packages/sonar-scanner.md +++ b/docs/docs/mp-packages/sonar-scanner.md @@ -18,10 +18,9 @@ The `sonar-scanner` executable must be installed and available on `PATH` when th ## Run analysis ```csharp -using ModularPipelines.SonarScanner.Extensions; using ModularPipelines.SonarScanner.Options; -var result = await context.SonarScanner().ExecuteAsync( +var result = await context.Tools.SonarScanner.ExecuteAsync( new SonarScannerExecuteOptions { ProjectKey = "example-project", diff --git a/docs/docs/mp-packages/syft.md b/docs/docs/mp-packages/syft.md index ef90a8aa2d1..ced66a6ebc7 100644 --- a/docs/docs/mp-packages/syft.md +++ b/docs/docs/mp-packages/syft.md @@ -16,14 +16,13 @@ Required command-line tool: `syft`. It must be installed and available on `PATH` ## Context entry points -Import `ModularPipelines.Syft.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Syft()` +- `context.Tools.Syft` ## Module example ```csharp -using ModularPipelines.Syft.Extensions; public class UseSyftModule : SyncModule { @@ -31,7 +30,7 @@ public class UseSyftModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var syft = context.Syft(); + var syft = context.Tools.Syft; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Syft integration is ready"); diff --git a/docs/docs/mp-packages/teamcity.md b/docs/docs/mp-packages/teamcity.md index 35f15567de6..5622c3eeab5 100644 --- a/docs/docs/mp-packages/teamcity.md +++ b/docs/docs/mp-packages/teamcity.md @@ -14,14 +14,13 @@ dotnet add package ModularPipelines.TeamCity ## Context entry points -Import `ModularPipelines.TeamCity.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.TeamCity()` +- `context.Tools.TeamCity` ## Module example ```csharp -using ModularPipelines.TeamCity.Extensions; public class UseTeamCityModule : SyncModule { @@ -29,7 +28,7 @@ public class UseTeamCityModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var teamCity = context.TeamCity(); + var teamCity = context.Tools.TeamCity; // Call the integration's strongly typed operations here. context.Logger.LogInformation("TeamCity integration is ready"); diff --git a/docs/docs/mp-packages/terraform.md b/docs/docs/mp-packages/terraform.md index d381e555fd4..834eb93f813 100644 --- a/docs/docs/mp-packages/terraform.md +++ b/docs/docs/mp-packages/terraform.md @@ -16,9 +16,9 @@ Required command-line tool: `terraform`. It must be installed and available on ` ## Context entry points -Import `ModularPipelines.Terraform.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Terraform()` +- `context.Tools.Terraform` ## Module example @@ -26,7 +26,6 @@ Import `ModularPipelines.Terraform.Extensions`, then use this service from a mod using ModularPipelines.Context; using ModularPipelines.Models; using ModularPipelines.Modules; -using ModularPipelines.Terraform.Extensions; using ModularPipelines.Terraform.Options; public class UseTerraformModule : Module @@ -35,7 +34,7 @@ public class UseTerraformModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.Terraform().ValidateAsync( + return await context.Tools.Terraform.ValidateAsync( new TerraformValidateOptions(), cancellationToken: cancellationToken); } diff --git a/docs/docs/mp-packages/trivy.md b/docs/docs/mp-packages/trivy.md index 1c8b4930d16..d1c0c1ef305 100644 --- a/docs/docs/mp-packages/trivy.md +++ b/docs/docs/mp-packages/trivy.md @@ -18,11 +18,10 @@ The `trivy` executable must be installed and available on `PATH` when the pipeli ## Scan an image ```csharp -using ModularPipelines.Trivy.Extensions; using ModularPipelines.Trivy.Enums; using ModularPipelines.Trivy.Options; -var result = await context.Trivy().ImageAsync( +var result = await context.Tools.Trivy.ImageAsync( new TrivyImageOptions { ImageName = "alpine:3.20", @@ -43,7 +42,7 @@ trivy image alpine:3.20 --format=json --output=trivy-results.json --severity=HIG ## Scan a filesystem ```csharp -var result = await context.Trivy().FilesystemAsync( +var result = await context.Tools.Trivy.FilesystemAsync( new TrivyFilesystemOptions("./src") { Scanners = diff --git a/docs/docs/mp-packages/vault.md b/docs/docs/mp-packages/vault.md index 32df8f2c069..4553222e6e1 100644 --- a/docs/docs/mp-packages/vault.md +++ b/docs/docs/mp-packages/vault.md @@ -16,14 +16,13 @@ Required command-line tool: `vault`. It must be installed and available on `PATH ## Context entry points -Import `ModularPipelines.Vault.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Vault()` +- `context.Tools.Vault` ## Module example ```csharp -using ModularPipelines.Vault.Extensions; public class UseVaultModule : SyncModule { @@ -31,7 +30,7 @@ public class UseVaultModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var vault = context.Vault(); + var vault = context.Tools.Vault; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Vault integration is ready"); diff --git a/docs/docs/mp-packages/winget.md b/docs/docs/mp-packages/winget.md index 4a2f18424ad..bbbc66cfeaa 100644 --- a/docs/docs/mp-packages/winget.md +++ b/docs/docs/mp-packages/winget.md @@ -16,14 +16,13 @@ Required command-line tool: `winget`. It must be installed and available on `PAT ## Context entry points -Import `ModularPipelines.WinGet.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Winget()` +- `context.Tools.Winget` ## Module example ```csharp -using ModularPipelines.WinGet.Extensions; public class UseWingetModule : SyncModule { @@ -31,7 +30,7 @@ public class UseWingetModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var winget = context.Winget(); + var winget = context.Tools.Winget; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Winget integration is ready"); diff --git a/docs/docs/mp-packages/yq.md b/docs/docs/mp-packages/yq.md index c866c194bf7..42a5c6efa15 100644 --- a/docs/docs/mp-packages/yq.md +++ b/docs/docs/mp-packages/yq.md @@ -16,14 +16,13 @@ Required command-line tool: `yq`. It must be installed and available on `PATH` w ## Context entry points -Import `ModularPipelines.Yq.Extensions`, then use this service from a module: +Use the discoverable `context.Tools` surface from a module: -- `context.Yq()` +- `context.Tools.Yq` ## Module example ```csharp -using ModularPipelines.Yq.Extensions; public class UseYqModule : SyncModule { @@ -31,7 +30,7 @@ public class UseYqModule : SyncModule IModuleContext context, CancellationToken cancellationToken) { - var yq = context.Yq(); + var yq = context.Tools.Yq; // Call the integration's strongly typed operations here. context.Logger.LogInformation("Yq integration is ready"); diff --git a/src/ModularPipelines.SourceGenerator/GeneratorDiagnostics.cs b/src/ModularPipelines.SourceGenerator/GeneratorDiagnostics.cs index a12d640dd62..8ab3f3ba37d 100644 --- a/src/ModularPipelines.SourceGenerator/GeneratorDiagnostics.cs +++ b/src/ModularPipelines.SourceGenerator/GeneratorDiagnostics.cs @@ -63,7 +63,8 @@ internal static class GeneratorDiagnostics "MPG0008", "Discoverable tool properties require C# 14", "Tool accessor '{0}' cannot generate a context.Tools property because language version " - + "'{1}' does not support extension members; use C# 14 or preview", + + "'{1}' does not support extension members; use C# 14 or preview, or call the " + + "compatibility accessor context.{2}()", DiagnosticSeverity.Warning); public static DiagnosticDescriptor ConflictingToolProperty { get; } = Create( diff --git a/src/ModularPipelines.SourceGenerator/ModularPipelinesIntegrationGenerator.cs b/src/ModularPipelines.SourceGenerator/ModularPipelinesIntegrationGenerator.cs index aaf4fdf0f06..3d6050609a2 100644 --- a/src/ModularPipelines.SourceGenerator/ModularPipelinesIntegrationGenerator.cs +++ b/src/ModularPipelines.SourceGenerator/ModularPipelinesIntegrationGenerator.cs @@ -306,7 +306,8 @@ private static void Generate( UnsupportedToolsLanguageVersion, firstProperty.Location, firstProperty.MethodName, - GetLanguageVersionDisplay(parseOptions))); + GetLanguageVersionDisplay(parseOptions), + EscapeIdentifier(firstProperty.Name))); } else if (uniqueToolProperties.Length > 0) { diff --git a/src/ModularPipelines.Templates/templates/modularpipeline/Modules/BuildModule.cs b/src/ModularPipelines.Templates/templates/modularpipeline/Modules/BuildModule.cs index 60b49bc115b..75b3f1341bb 100644 --- a/src/ModularPipelines.Templates/templates/modularpipeline/Modules/BuildModule.cs +++ b/src/ModularPipelines.Templates/templates/modularpipeline/Modules/BuildModule.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.Options; using ModularPipelines.Attributes; using ModularPipelines.Context; -using ModularPipelines.DotNet.Extensions; using ModularPipelines.DotNet.Options; using ModularPipelines.Models; using ModularPipelines.Modules; @@ -16,7 +15,7 @@ public sealed class BuildModule(IOptions settings) : Module settings) : Module settings) : Module settings) : Module IModuleContext context, CancellationToken cancellationToken) { - await context.DotNet().BuildAsync( + await context.Tools.DotNet.BuildAsync( new DotNetBuildOptions { ProjectSolution = "MySolution.sln", @@ -65,7 +64,7 @@ public sealed class TestModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.DotNet().TestAsync( + return await context.Tools.DotNet.TestAsync( new DotNetTestOptions { Project = "MySolution.sln", @@ -94,7 +93,7 @@ public sealed class PublishCommandModule : Module IModuleContext context, CancellationToken cancellationToken) { - return await context.DotNet().PublishAsync( + return await context.Tools.DotNet.PublishAsync( new DotNetPublishOptions { ProjectSolution = "src/MyApp/MyApp.csproj", diff --git a/test/ModularPipelines.SourceGenerator.UnitTests/ModularPipelinesIntegrationGeneratorTests.cs b/test/ModularPipelines.SourceGenerator.UnitTests/ModularPipelinesIntegrationGeneratorTests.cs index 5b2f3b1c3dc..a9415e2fda8 100644 --- a/test/ModularPipelines.SourceGenerator.UnitTests/ModularPipelinesIntegrationGeneratorTests.cs +++ b/test/ModularPipelines.SourceGenerator.UnitTests/ModularPipelinesIntegrationGeneratorTests.cs @@ -179,12 +179,42 @@ public static void Register(IServiceCollection services) await Assert.That(diagnostic.Id).IsEqualTo("MPG0008"); await Assert.That(diagnostic.Severity).IsEqualTo(DiagnosticSeverity.Warning); await Assert.That(diagnostic.GetMessage()).Contains("C# 14"); + await Assert.That(diagnostic.GetMessage()).Contains("context.Git()"); await Assert.That(generatedSource).DoesNotContain("extension("); await Assert.That(generatedSource) .Contains("global::GitIntegration.Register(services);"); } } + [Test] + public async Task Keyword_Tool_Accessor_On_Older_Language_Version_Is_Escaped_In_Diagnostic() + { + var result = RunGenerator(""" + using ModularPipelines.Attributes; + using ModularPipelines.Context; + using Microsoft.Extensions.DependencyInjection; + + public interface IClassTool + { + } + + public static class ClassIntegration + { + [ModularPipelinesIntegration] + public static void Register(IServiceCollection services) + { + } + + public static IClassTool @class(this IPipelineContext context) => throw null!; + } + """, LanguageVersion.CSharp13); + + var diagnostic = result.Diagnostics.Single(); + + await Assert.That(diagnostic.Id).IsEqualTo("MPG0008"); + await Assert.That(diagnostic.GetMessage()).Contains("context.@class()"); + } + [Test] public async Task Referenced_Conflicts_On_Older_Language_Version_Are_Ignored() { diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/MarkdownDocumentationGeneratorTests.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/MarkdownDocumentationGeneratorTests.cs index 4b1c2f2aacc..81a73d198c0 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/MarkdownDocumentationGeneratorTests.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/MarkdownDocumentationGeneratorTests.cs @@ -55,13 +55,18 @@ await Assert.That(files[0].RelativePath.Replace('\\', '/')) await Assert.That(files[0].Content) .Contains("This package does not install the `fake-cli` executable"); await Assert.That(files[0].Content).Contains("`fake-cli` is available on `PATH`"); - await Assert.That(files[0].Content).Contains("context.Fake()"); + await Assert.That(files[0].Content).Contains("context.Tools.Fake"); + await Assert.That(files[0].Content).Contains("compatibility fallback"); + await Assert.That(files[0].Content) + .Contains("import `ModularPipelines.Fake.Extensions`"); + await Assert.That(files[0].Content) + .DoesNotContain("using ModularPipelines.Fake.Extensions;"); await Assert.That(files[0].Content).Contains("using ModularPipelines.Context;"); await Assert.That(files[0].Content).Contains("using ModularPipelines.Models;"); await Assert.That(files[0].Content).Contains("using ModularPipelines.Modules;"); await Assert.That(files[0].Content).Contains("Module"); await Assert.That(files[0].Content).Contains("Task ExecuteAsync"); - await Assert.That(files[0].Content).Contains("return await context.Fake()"); + await Assert.That(files[0].Content).Contains("return await context.Tools.Fake"); await Assert.That(files[0].Content).Contains("| `fake-cli run` | `FakeRunOptions` |"); await Assert.That(files[0].Content).Contains("new FakeRunOptions(\"sample.csproj\")"); } @@ -203,11 +208,11 @@ public async Task GenerateAsync_UsesExecuteForCollidingPreferredCommands() var testCases = new[] { (Tool: rootCollisionTool, - Invocation: "context.Fake().App.ExecuteAsync(", + Invocation: "context.Tools.Fake.App.ExecuteAsync(", ServiceFile: "FakeApp.Generated.cs", OptionsType: "FakeAppOptions"), (Tool: nestedCollisionTool, - Invocation: "context.Fake().App.Get.ExecuteAsync(", + Invocation: "context.Tools.Fake.App.Get.ExecuteAsync(", ServiceFile: "FakeAppGet.Generated.cs", OptionsType: "FakeAppGetOptions"), }; @@ -314,8 +319,8 @@ public async Task GenerateAsync_SelectsExampleCommandDeterministically() var documentation = await new MarkdownDocumentationGenerator().GenerateAsync(tool); - await Assert.That(documentation[0].Content).Contains("context.Fake().ZetaAsync("); - await Assert.That(documentation[0].Content).DoesNotContain("context.Fake().AlphaAsync("); + await Assert.That(documentation[0].Content).Contains("context.Tools.Fake.ZetaAsync("); + await Assert.That(documentation[0].Content).DoesNotContain("context.Tools.Fake.AlphaAsync("); } [Test] @@ -393,7 +398,7 @@ public async Task GenerateAsync_OmitsRunnableExampleWithoutQualifiedMetadata() await Assert.That(documentation[0].Content) .Contains("A runnable example is omitted when no command has complete safety metadata"); - await Assert.That(documentation[0].Content).DoesNotContain("context.Fake().DeleteAsync("); + await Assert.That(documentation[0].Content).DoesNotContain("context.Tools.Fake.DeleteAsync("); } [Test] @@ -475,7 +480,7 @@ public async Task GenerateAsync_EnforcesIntentionalCatalogOmission() await Assert.That(documentation[0].Content) .Contains("A runnable example is omitted when no command has complete safety metadata"); await Assert.That(documentation[0].Content) - .DoesNotContain("context.Fake().VersionAsync("); + .DoesNotContain("context.Tools.Fake.VersionAsync("); } [Test] @@ -566,17 +571,17 @@ public async Task GenerateAsync_UsesCuratedSafeRegressionExamples() await Assert.That(ansibleDocumentation).Contains("new AnsibleExecuteOptions(\"localhost\")"); await Assert.That(ansibleDocumentation).Contains("ListHosts = true"); - await Assert.That(buildahDocumentation).Contains("context.Fake().ContainersAsync("); - await Assert.That(buildahDocumentation).DoesNotContain("context.Fake().AddAsync("); + await Assert.That(buildahDocumentation).Contains("context.Tools.Fake.ContainersAsync("); + await Assert.That(buildahDocumentation).DoesNotContain("context.Tools.Fake.AddAsync("); await Assert.That(jqDocumentation).Contains("Filter = \".\""); await Assert.That(jqDocumentation).Contains("InputFiles = [\"input.json\"]"); await Assert.That(newmanDocumentation) .Contains("A runnable example is omitted when no command has complete safety metadata"); - await Assert.That(newmanDocumentation).DoesNotContain("context.Fake().RunAsync("); - await Assert.That(newmanDocumentation).DoesNotContain("context.Fake().UrlAsync("); - await Assert.That(packerDocumentation).DoesNotContain("context.Fake().ConsoleAsync("); - await Assert.That(vaultDocumentation).Contains("context.Fake().StatusAsync("); - await Assert.That(vaultDocumentation).DoesNotContain("context.Fake().DeleteAsync("); + await Assert.That(newmanDocumentation).DoesNotContain("context.Tools.Fake.RunAsync("); + await Assert.That(newmanDocumentation).DoesNotContain("context.Tools.Fake.UrlAsync("); + await Assert.That(packerDocumentation).DoesNotContain("context.Tools.Fake.ConsoleAsync("); + await Assert.That(vaultDocumentation).Contains("context.Tools.Fake.StatusAsync("); + await Assert.That(vaultDocumentation).DoesNotContain("context.Tools.Fake.DeleteAsync("); foreach (var tool in new[] { ansible, buildah, jq, vault }) { @@ -590,43 +595,43 @@ public async Task GenerateAsync_UsesCuratedExamplesForPopularTools() var testCases = new[] { (Tool("az", Command("az account list", "AzAccountListOptions", ["account", "list"], "account")), - "context.Fake().Account.ListAsync("), + "context.Tools.Fake.Account.ListAsync("), (Tool("cargo", Command("cargo check", "CargoCheckOptions", ["check"]) with { Options = [Option("--quiet", "Quiet", "bool?")], }), - "context.Fake().CheckAsync("), + "context.Tools.Fake.CheckAsync("), (Tool("docker", Command("docker info", "DockerInfoOptions", ["info"])), - "context.Fake().InfoAsync("), + "context.Tools.Fake.InfoAsync("), (Tool("dotnet", Command("dotnet workload list", "DotNetWorkloadListOptions", ["workload", "list"], "workload")), - "context.Fake().Workload.ListAsync("), + "context.Tools.Fake.Workload.ListAsync("), (Tool("gcloud", Command("gcloud info", "GcloudInfoOptions", ["info"]) with { Options = [Option("--anonymize", "Anonymize", "bool?")], }), - "context.Fake().InfoAsync("), + "context.Tools.Fake.InfoAsync("), (Tool("gh", Command("gh config list", "GhConfigListOptions", ["config", "list"], "config")), - "context.Fake().Config.ListAsync("), + "context.Tools.Fake.Config.ListAsync("), (Tool("git", Command("git status", "GitStatusOptions", ["status"]) with { Options = [Option("--short", "Short", "bool?")], }), - "context.Fake().StatusAsync("), + "context.Tools.Fake.StatusAsync("), (Tool("go", Command("go vet", "GoVetOptions", ["vet"])), - "context.Fake().VetAsync("), + "context.Tools.Fake.VetAsync("), (Tool("helm", Command("helm env", "HelmEnvOptions", ["env"])), - "context.Fake().EnvAsync("), + "context.Tools.Fake.EnvAsync("), (Tool("kubectl", Command("kubectl config view", "KubernetesConfigViewOptions", ["config", "view"], "config")), - "context.Fake().Config.ViewAsync("), + "context.Tools.Fake.Config.ViewAsync("), (Tool("pip", Command("pip freeze", "PipFreezeOptions", ["freeze"])), - "context.Fake().FreezeAsync("), + "context.Tools.Fake.FreezeAsync("), (Tool("pnpm", Command("pnpm audit", "PnpmAuditOptions", ["audit"]) with { Options = [Option("--audit-level", "AuditLevel", "string?")], }), - "context.Fake().AuditAsync("), + "context.Tools.Fake.AuditAsync("), (Tool("terraform", Command("terraform validate", "TerraformValidateOptions", ["validate"])), - "context.Fake().ValidateAsync("), + "context.Tools.Fake.ValidateAsync("), }; foreach (var (tool, expectedInvocation) in testCases) @@ -731,6 +736,7 @@ namespace ModularPipelines.Context { public interface IModuleContext { + {{tool.TargetNamespace}}.Extensions.I{{tool.NamespacePrefix}}Tools Tools { get; } } } @@ -770,6 +776,11 @@ public interface I{{tool.NamespacePrefix}}Service {{serviceMembers.RootMember}} } + public interface I{{tool.NamespacePrefix}}Tools + { + I{{tool.NamespacePrefix}}Service {{tool.NamespacePrefix}} { get; } + } + {{serviceMembers.NavigationTypes}} public static class {{tool.NamespacePrefix}}Extensions @@ -787,7 +798,7 @@ private static IReadOnlyList GetNavigationSegments( CliCommandDefinition command) { var invocation = MarkdownDocumentationGenerator.BuildInvocation(tool, command); - var prefix = $"context.{tool.NamespacePrefix}()."; + var prefix = $"context.Tools.{tool.NamespacePrefix}."; return invocation[prefix.Length..].Split('.'); } diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/DependencyRegistrationGenerator.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/DependencyRegistrationGenerator.cs index d7585077226..a5f589d4fd8 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/DependencyRegistrationGenerator.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/DependencyRegistrationGenerator.cs @@ -102,9 +102,9 @@ private static string GenerateExtensionsClass(CliToolDefinition tool) sb.AppendLine(" }"); sb.AppendLine(); - // Extension method for context access (traditional extension method syntax for compatibility) + // Traditional extension method retained as a pre-C# 14 compatibility accessor. sb.AppendLine(" /// "); - sb.AppendLine($" /// Gets the {tool.ToolName} service from the pipeline context."); + sb.AppendLine($" /// Gets the {tool.ToolName} service from the pipeline context for compatibility."); sb.AppendLine(" /// "); sb.AppendLine(" /// The pipeline context."); sb.AppendLine($" /// The service for executing {tool.ToolName} commands."); diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/MarkdownDocumentationGenerator.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/MarkdownDocumentationGenerator.cs index 0320c93b784..ece46629685 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/MarkdownDocumentationGenerator.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/MarkdownDocumentationGenerator.cs @@ -65,7 +65,10 @@ private static string GenerateMarkdown(CliToolDefinition tool) sb.AppendLine($"dotnet add package {tool.TargetNamespace}"); sb.AppendLine("```"); sb.AppendLine(); - sb.AppendLine($"Import `{tool.TargetNamespace}.Extensions`, then resolve the service with `context.{tool.NamespacePrefix}()`."); + sb.AppendLine( + $"Resolve the service with `context.Tools.{tool.NamespacePrefix}`. " + + $"For projects older than C# 14, import `{tool.TargetNamespace}.Extensions` " + + $"and use the `context.{tool.NamespacePrefix}()` extension method as a compatibility fallback."); sb.AppendLine(); AppendExample(sb, tool); AppendGlobalOptions(sb, tool); @@ -190,9 +193,8 @@ private static void AppendExample(StringBuilder sb, CliToolDefinition tool) + "A runnable example is omitted when no command has complete safety metadata:"); sb.AppendLine(); sb.AppendLine("```csharp"); - sb.AppendLine($"using {tool.TargetNamespace}.Extensions;"); - sb.AppendLine(); - sb.AppendLine($"var {ToCamelCase(tool.NamespacePrefix)} = context.{tool.NamespacePrefix}();"); + sb.AppendLine( + $"var {ToCamelCase(tool.NamespacePrefix)} = context.Tools.{tool.NamespacePrefix};"); sb.AppendLine("```"); sb.AppendLine(); return; @@ -205,7 +207,6 @@ private static void AppendExample(StringBuilder sb, CliToolDefinition tool) sb.AppendLine("using ModularPipelines.Context;"); sb.AppendLine("using ModularPipelines.Models;"); sb.AppendLine("using ModularPipelines.Modules;"); - sb.AppendLine($"using {tool.TargetNamespace}.Extensions;"); sb.AppendLine($"using {tool.TargetNamespace}.Options;"); sb.AppendLine(); sb.AppendLine("public class RunCommandModule : Module"); @@ -281,10 +282,10 @@ internal static string BuildInvocation( } var subDomain = GeneratorUtils.GetCommandGroupIdentifier(subDomainParent); - return $"context.{tool.NamespacePrefix}().{subDomain}.ExecuteAsync"; + return $"context.Tools.{tool.NamespacePrefix}.{subDomain}.ExecuteAsync"; } - return $"context.{tool.NamespacePrefix}().{GeneratorUtils.EnsureAsyncSuffix(rootMethod)}"; + return $"context.Tools.{tool.NamespacePrefix}.{GeneratorUtils.EnsureAsyncSuffix(rootMethod)}"; } var navigationSegments = new List @@ -304,11 +305,11 @@ internal static string BuildInvocation( && IsCommandPrefix(command, candidate))) { navigationSegments.Add(GeneratorUtils.ToPascalCase(command.CommandParts[^1])); - return $"context.{tool.NamespacePrefix}().{string.Join('.', navigationSegments)}.ExecuteAsync"; + return $"context.Tools.{tool.NamespacePrefix}.{string.Join('.', navigationSegments)}.ExecuteAsync"; } var methodName = GeneratorUtils.GenerateMethodNameFromLastCommandPart(command); - return $"context.{tool.NamespacePrefix}().{string.Join('.', navigationSegments)}.{GeneratorUtils.EnsureAsyncSuffix(methodName)}"; + return $"context.Tools.{tool.NamespacePrefix}.{string.Join('.', navigationSegments)}.{GeneratorUtils.EnsureAsyncSuffix(methodName)}"; } private static bool IsCommandPrefix(