This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Build the entire solution
dotnet build ModularPipelines.sln -c Release
# Build specific solution (examples, analyzers, etc.)
dotnet build ModularPipelines.Examples.sln -c Release
dotnet build ModularPipelines.Analyzers.sln -c Release
# Run the build pipeline (from src/ModularPipelines.Build)
cd src/ModularPipelines.Build
dotnet run -c Release --framework net10.0# Run all unit tests (pattern: *UnitTests.csproj)
# Tests are executed via the build pipeline with coverage
cd src/ModularPipelines.Build
dotnet run -c Release --framework net10.0
# Run a single test project manually
dotnet run --project <path-to-test-project> --framework net10.0 -- --coverage --coverage-output-format cobertura# Format code (automatically done in CI)
dotnet format
dotnet format whitespace
# Verify formatting without changes
dotnet format --verify-no-changes --severity infoModule-Based Pipeline Architecture: ModularPipelines uses a module system where each unit of work is a self-contained Module<T> class. Modules can depend on each other via [DependsOn<T>] attributes, creating a dependency graph that automatically parallelizes work.
Key Components:
-
Module System (
src/ModularPipelines/Modules/):- Base class:
Module<T>where T is the return type - Modules execute via
ExecuteAsync(IModuleContext context, CancellationToken cancellationToken) - Dependencies declared with
[DependsOn<TModule>]attributes - Skip conditions via
ShouldSkip()method - Retry policies configurable per module
- Base class:
-
Module Context (
IModuleContext):- Central interface providing access to all tools and services
- Includes: file system operations, command execution, logging, Git info
- Extensions for each tool integration (e.g.,
context.DotNet(),context.Git())
-
Host Pattern (
PipelineHostBuilder):- Built on Microsoft Generic Host
- Full dependency injection support
- Configuration via
appsettings.json, user secrets, environment variables - Module registration and pipeline execution
-
Tool Integrations:
- Each tool (DotNet, Git, Docker, etc.) has its own package
- Strongly-typed options classes for CLI commands
- Fluent API for building complex commands
- Automatic secret obfuscation in logs
-
Code Generation:
- Tool options classes (e.g.,
GitAddOptions,DotNetBuildOptions,DockerRunOptions) are auto-generated - Generator located at:
tools/ModularPipelines.OptionsGenerator/ - Do not modify generated options classes directly - changes will be overwritten
- To modify options behavior, update the generator or add manual extension files
- Generated files have
[ExcludeFromCodeCoverage]attribute
- Tool options classes (e.g.,
src/ModularPipelines/- Core frameworksrc/ModularPipelines.*- Tool-specific integrations (DotNet, Git, Docker, Azure, AWS, etc.)src/ModularPipelines.Build/- This project's build pipelinetest/*.UnitTests/- Unit test projectsdocs/- Docusaurus documentation site
The build pipeline (src/ModularPipelines.Build/) demonstrates best practices:
- Separate modules for each build step
- Dependency management between modules
- Conditional execution based on environment (development vs CI)
- Integration with GitHub Actions, NuGet publishing, code coverage
- Strong Typing: All data passed between modules is strongly typed
- Parallel Execution: Work runs concurrently unless dependencies prevent it
- Dependency Injection: Full DI support for services and configuration
- Hooks: Before/after module execution hooks
- Requirements: Pipeline requirements validation (OS, permissions, etc.)
- Skip Logic: Modules can be skipped based on custom conditions
- Progress Reporting: Real-time console progress with parallel execution visualization
- Create modules by inheriting from
Module<T> - Define dependencies with
[DependsOn<T>]attributes - Implement
ExecuteAsyncmethod - Register modules in
Program.csusingAddModule<T>() - Configure services and settings via DI
- Run pipeline with
dotnet run
- Unit tests use the project's own pipeline system
- Tests run with code coverage collection enabled
- Coverage reports uploaded to Codacy and Codecov
- Test projects identified by "*UnitTests.csproj" pattern
- remember the correct filter syntax