Project Structure and Tech Stack - Garume/Manifold GitHub Wiki

Project Structure and Tech Stack

This page provides a comprehensive guide to the Manifold monorepo directory layout, its 16 constituent projects, target frameworks, key dependencies, and tooling choices. It serves as the essential orientation reference for contributors who need to understand where code lives, how projects relate to each other, and what technologies underpin the build and runtime systems.

Manifold is organized as a single Git repository containing four library packages under src/, four sample applications under samples/, five test projects under tests/, two benchmark projects under benchmarks/, and a set of PowerShell build scripts under build/. For the high-level architectural relationships between the four core packages, see Architecture Overview. For build automation details, see Build System and Scripts.

Repository Root Layout

Manifold/
├── .editorconfig                # Code style rules
├── .github/workflows/           # CI/CD pipelines (ci.yml, publish.yml)
├── .artifacts/                  # Build outputs (packages, benchmarks, tests)
├── assets/                      # Logo and benchmark assets
├── benchmarks/                  # Performance benchmark projects
├── build/                       # PowerShell build scripts
├── samples/                     # Sample host applications
├── src/                         # Core library source code
├── tests/                       # Unit and integration test projects
├── Directory.Build.props        # Shared MSBuild properties
├── Directory.Build.targets      # Shared MSBuild targets
├── global.json                  # .NET SDK version pinning
├── Manifold.slnx                # Solution file (XML format)
├── xunit.runner.json            # xUnit runner configuration
├── LICENSE                      # MIT license
├── README.md                    # Project readme (English)
├── README.ja.md                 # Project readme (Japanese)
├── CONTRIBUTING.md              # Contribution guidelines
└── THIRD_PARTY_NOTICES.md       # Third-party license notices

Sources: Manifold.slnx:1-21, Directory.Build.props:1-34, global.json:1-9

Directory Structure Diagram

flowchart TD
    Root["Manifold Repository"]
    Src["src/"]
    Tests["tests/"]
    Samples["samples/"]
    Bench["benchmarks/"]
    Build["build/"]
    CI[".github/workflows/"]
    Artifacts[".artifacts/"]

    Root --> Src
    Root --> Tests
    Root --> Samples
    Root --> Bench
    Root --> Build
    Root --> CI
    Root --> Artifacts

    Src --> M["Manifold"]
    Src --> MC["Manifold.Cli"]
    Src --> MG["Manifold.Generators"]
    Src --> MM["Manifold.Mcp"]

    Tests --> T1["Manifold.Tests"]
    Tests --> T2["Manifold.Cli.Tests"]
    Tests --> T3["Manifold.Generators.Tests"]
    Tests --> T4["Manifold.Mcp.Tests"]
    Tests --> T5["Manifold.Samples.Tests"]

    Samples --> S1["Samples.Operations"]
    Samples --> S2["Samples.CliHost"]
    Samples --> S3["Samples.McpStdioHost"]
    Samples --> S4["Samples.McpHttpHost"]

    Bench --> B1["Manifold.Benchmarks"]
    Bench --> B2["Mcp.Benchmarks"]
Loading

All 16 Projects

The solution file Manifold.slnx organizes projects into three solution folders: /src/, /tests/, and /samples/. The two benchmark projects reside under benchmarks/ but are not included in the solution file (they are built independently).

Sources: Manifold.slnx:1-21

Project Summary Table

# Project Directory Type Target Framework Description
1 Manifold src/Manifold/ Library (NuGet) net10.0 Core contracts, attributes, descriptors
2 Manifold.Cli src/Manifold.Cli/ Library (NuGet) net10.0 CLI binding and invocation runtime
3 Manifold.Generators src/Manifold.Generators/ Analyzer (NuGet) netstandard2.0 Incremental source generator
4 Manifold.Mcp src/Manifold.Mcp/ Library (NuGet) net10.0 MCP binding and invocation runtime
5 Manifold.Tests tests/Manifold.Tests/ Test (Exe) net10.0 Core package unit tests
6 Manifold.Cli.Tests tests/Manifold.Cli.Tests/ Test (Exe) net10.0 CLI package unit tests
7 Manifold.Generators.Tests tests/Manifold.Generators.Tests/ Test (Exe) net10.0 Generator unit tests
8 Manifold.Mcp.Tests tests/Manifold.Mcp.Tests/ Test (Exe) net10.0 MCP package unit tests
9 Manifold.Samples.Tests tests/Manifold.Samples.Tests/ Test (Exe) net10.0 Integration smoke tests
10 Manifold.Samples.Operations samples/Manifold.Samples.Operations/ Library net10.0 Shared sample operation definitions
11 Manifold.Samples.CliHost samples/Manifold.Samples.CliHost/ Console App net10.0 CLI host sample
12 Manifold.Samples.McpStdioHost samples/Manifold.Samples.McpStdioHost/ Console App net10.0 MCP stdio transport sample
13 Manifold.Samples.McpHttpHost samples/Manifold.Samples.McpHttpHost/ Web App net10.0 MCP HTTP transport sample
14 Manifold.Benchmarks benchmarks/Manifold.Benchmarks/ Console App net10.0 CLI performance benchmarks
15 Manifold.Mcp.Benchmarks benchmarks/Manifold.Mcp.Benchmarks/ Console App net10.0 MCP performance benchmarks
16 Inspect (internal) .tmpinspect/Inspect/ Console App net10.0 Temporary inspection utility

Target Frameworks

Manifold uses two target frameworks across its projects:

  • net10.0 — The primary target for all library, test, sample, and benchmark projects. The SDK version is pinned to 10.0.101 with latestFeature roll-forward policy in global.json.
  • netstandard2.0 — Used exclusively by Manifold.Generators, the source generator project. This is required because Roslyn analyzer/generator assemblies must target netstandard2.0 to be loaded by the compiler.

The Manifold.Generators project explicitly overrides the default TargetFramework from Directory.Build.props (which sets net10.0) with netstandard2.0 in its own .csproj.

Sources: global.json:1-9, Directory.Build.props:3, Manifold.Generators.csproj:3

Source Projects (src/)

Manifold (Core)

The foundational package defining operation contracts, attributes, descriptors, and binding primitives. All other Manifold packages depend on this.

Source files:

File Purpose
IOperation.cs IOperation<TRequest, TResult> interface for class-based operations
OperationAttribute.cs [Operation] and surface visibility attributes
ParameterAttributes.cs [Option], [Argument], [Alias], [CliName], [McpName], [FromServices], [ResultFormatter]
DescriptorModels.cs OperationDescriptor, ParameterDescriptor, enums (InvocationSurface, OperationVisibility, ParameterSource)
OperationBinding.cs Parameter binding logic
OperationContext.cs OperationContext with service resolution
OperationInvoker.cs Reflection-based operation invocation
IResultFormatter.cs IResultFormatter interface for custom formatting

Sources: Manifold.csproj:1-19, src/Manifold/ directory listing

Manifold.Cli

CLI binding and fast invocation runtime. Depends on Manifold core.

Source files:

File Purpose
CliApplication.cs Entry point for CLI dispatch
CliBinding.cs Command-line argument binding
CliInvocationResult.cs Standard CLI result type
FastCliInvocationResult.cs Zero-allocation fast-path result
ICliInvoker.cs CLI invoker interface
IFastCliInvoker.cs Fast-path CLI invoker interfaces
CliExitCodes.cs Exit code constants

Sources: Manifold.Cli.csproj:1-22

Manifold.Generators

Incremental C# source generator targeting netstandard2.0. Analyzes [Operation]-attributed code and emits registry, invoker, and catalog source files at compile time.

Single source file:

File Purpose
OperationDescriptorGenerator.cs IIncrementalGenerator implementation; emits GeneratedOperationRegistry, GeneratedCliInvoker, GeneratedMcpCatalog, and GeneratedMcpInvoker

The project is configured as a Roslyn component (IsRoslynComponent=true) and packages its output DLL into the analyzers/dotnet/cs NuGet folder rather than as a standard library reference (IncludeBuildOutput=false).

Sources: Manifold.Generators.csproj:1-45, OperationDescriptorGenerator.cs:1-30

Manifold.Mcp

MCP binding and invocation runtime. Depends on Manifold core and the ModelContextProtocol SDK.

Source files:

File Purpose
McpInvoker.cs MCP tool invoker with fast-path interfaces
McpBinding.cs JSON argument binding for MCP
McpToolCatalogModels.cs Tool discovery metadata models
FastMcpInvocationResult.cs Zero-allocation MCP result
McpTextContentResponseWriter.cs Response formatting for MCP

Sources: Manifold.Mcp.csproj:1-27

Project Dependency Graph

flowchart TD
    M["Manifold<br/>(Core Contracts)"]
    MG["Manifold.Generators<br/>(Source Generator)"]
    MC["Manifold.Cli<br/>(CLI Runtime)"]
    MM["Manifold.Mcp<br/>(MCP Runtime)"]
    SO["Samples.Operations"]
    SCH["Samples.CliHost"]
    SSH["Samples.McpStdioHost"]
    SHH["Samples.McpHttpHost"]
    BM["Manifold.Benchmarks"]
    BMM["Mcp.Benchmarks"]

    MC --> M
    MM --> M
    MG -.->|"analyzes attributes from"| M

    SO --> M
    SO --> MC
    SO --> MM
    SO -.->|"analyzer ref"| MG

    SCH --> MC
    SCH --> SO

    SSH --> SO
    SHH --> SO

    BM --> M
    BM --> MC
    BM -.->|"analyzer ref"| MG

    BMM --> M
    BMM --> MM
    BMM -.->|"analyzer ref"| MG
Loading

Solid arrows represent project references; dashed arrows represent analyzer (source generator) references.

Test Projects (tests/)

All test projects share common configuration from Directory.Build.props via the IsManifoldTestProject property, which enables the Microsoft Testing Platform runner, sets OutputType to Exe, and adds shared test dependencies.

Project Tests For Coverage Threshold Key Dependencies
Manifold.Tests Core contracts and attributes 90% xunit.v3.mtp-v2 3.2.2
Manifold.Cli.Tests CLI binding and invocation 90% xunit.v3.mtp-v2 3.2.2, Microsoft.Extensions.DependencyInjection 10.0.0
Manifold.Generators.Tests Source generator output 90% xunit.v3.mtp-v2 3.2.2, Microsoft.CodeAnalysis.CSharp 4.14.0
Manifold.Mcp.Tests MCP binding and invocation 90% xunit.v3.mtp-v2 3.2.2, Microsoft.Extensions.DependencyInjection 10.0.0
Manifold.Samples.Tests Integration smoke tests 0% xunit.v3.mtp-v2 3.2.2

The Directory.Build.targets file enforces that every test project must define a CoverageThreshold property; the build fails if this is missing. Coverage is collected via coverlet.MTP version 8.0.0.

Sources: Directory.Build.props:18-33, Directory.Build.targets:13-17, Manifold.Tests.csproj:1-18, Manifold.Samples.Tests.csproj:1-15

For comprehensive testing documentation, see Testing Strategy.

Sample Projects (samples/)

The samples demonstrate how to wire Manifold into host applications. They share a common operations library (Manifold.Samples.Operations) that defines example operations consumed by three different host configurations.

Project SDK Purpose Key Extra Dependencies
Manifold.Samples.Operations Microsoft.NET.Sdk Shared operation definitions Manifold, Manifold.Cli, Manifold.Mcp, Manifold.Generators (analyzer)
Manifold.Samples.CliHost Microsoft.NET.Sdk CLI host entry point Microsoft.Extensions.DependencyInjection 10.0.0
Manifold.Samples.McpStdioHost Microsoft.NET.Sdk MCP stdio transport host Microsoft.Extensions.Hosting 10.0.0
Manifold.Samples.McpHttpHost Microsoft.NET.Sdk.Web MCP HTTP/SSE transport host ModelContextProtocol.AspNetCore 0.4.1-preview.1

Sources: Manifold.Samples.Operations.csproj:1-14, Manifold.Samples.CliHost.csproj:1-12, Manifold.Samples.McpStdioHost.csproj:1-10, Manifold.Samples.McpHttpHost.csproj:1-10

For walkthroughs of the sample hosts, see Sample — CLI Host and Samples — MCP Hosts (Stdio and HTTP).

Benchmark Projects (benchmarks/)

Project Purpose Comparison Frameworks
Manifold.Benchmarks CLI dispatch performance ConsoleAppFramework 5.7.13, System.CommandLine 2.0.5
Manifold.Mcp.Benchmarks MCP invocation performance McpToolkit.Server 0.1.3, mcpdotnet 1.1.0.1

Both use BenchmarkDotNet 0.15.8 and reference the Manifold source generator as an analyzer. Benchmark results are stored in .artifacts/benchmark-output/.

Sources: Manifold.Benchmarks.csproj:1-19, Manifold.Mcp.Benchmarks.csproj:1-20

For detailed benchmark analysis, see Performance and Benchmarks.

Build Scripts (build/)

The build/ directory contains PowerShell scripts that automate all development workflows.

Script Purpose
Get-DotNetCommand.ps1 Resolves the dotnet CLI path
restore.ps1 Restores NuGet packages
build.ps1 Builds src and sample projects
test.ps1 Runs all test projects
quality.ps1 Runs code quality checks
format.ps1 Enforces code formatting
pack.ps1 Creates NuGet packages to .artifacts/packages/
benchmark.ps1 Runs benchmarks
architecture.ps1 Validates architectural invariants

The build.ps1 script selectively builds only projects under src/ and samples/ directories by parsing the solution XML. The pack.ps1 script packages only src/ projects into .artifacts/packages/.

Sources: build.ps1:1-40, pack.ps1:1-55

For full build system documentation, see Build System and Scripts. For architecture validation details, see Architecture Validation and Code Quality.

CI/CD Workflows (.github/workflows/)

Workflow Trigger Purpose
ci.yml Push, Pull Request Build, test, quality checks
publish.yml Tag push NuGet package publishing, GitHub Release creation

See CI/CD and Release Pipeline for details.

Key Dependencies

Runtime Dependencies

Package Version Used By Purpose
ModelContextProtocol 1.1.0 Manifold.Mcp MCP SDK for tool invocation
ModelContextProtocol.AspNetCore 0.4.1-preview.1 Samples.McpHttpHost ASP.NET Core MCP integration
Microsoft.Extensions.DependencyInjection 10.0.0 Samples.CliHost, test projects DI container
Microsoft.Extensions.Hosting 10.0.0 Samples.McpStdioHost Generic host for stdio transport

Build/Analyzer Dependencies

Package Version Used By Purpose
Microsoft.CodeAnalysis.CSharp 4.14.0 Manifold.Generators Roslyn API for source generation
Microsoft.CodeAnalysis.Analyzers 3.11.0 Manifold.Generators Analyzer development rules

Test Dependencies

Package Version Used By Purpose
xunit.v3.mtp-v2 3.2.2 All test projects xUnit v3 with Microsoft Testing Platform
xunit.analyzers 1.27.0 All test projects (via Directory.Build.props) xUnit code analysis rules
coverlet.MTP 8.0.0 All test projects (via Directory.Build.props) Code coverage collection

Benchmark Dependencies

Package Version Used By Purpose
BenchmarkDotNet 0.15.8 Both benchmark projects Benchmarking framework
ConsoleAppFramework 5.7.13 Manifold.Benchmarks Comparison CLI framework
System.CommandLine 2.0.5 Manifold.Benchmarks Comparison CLI framework
McpToolkit.Server 0.1.3 Mcp.Benchmarks Comparison MCP framework
mcpdotnet 1.1.0.1 Mcp.Benchmarks Comparison MCP framework

Sources: Manifold.Mcp.csproj:20, Manifold.Generators.csproj:27-28, Directory.Build.props:25-29, Manifold.Benchmarks.csproj:8-10, Manifold.Mcp.Benchmarks.csproj:8-10

MSBuild Configuration

Directory.Build.props

Applies to all projects in the repository and sets shared defaults:

<PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <LangVersion>latest</LangVersion>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <WarningsAsErrors>$(WarningsAsErrors);nullable</WarningsAsErrors>
    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
    <AnalysisLevel>latest-recommended</AnalysisLevel>
    <EnableNETAnalyzers>true</EnableNETAnalyzers>
    <Deterministic>true</Deterministic>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

Key policies:

  • Warnings as errors — All warnings, including nullable reference warnings, are treated as errors.
  • Deterministic builds — Ensures reproducible build output.
  • Code style enforcementEnforceCodeStyleInBuild combined with .editorconfig rules enforces consistent formatting at build time.
  • Lock filesRestorePackagesWithLockFile ensures reproducible NuGet restores.

Sources: Directory.Build.props:1-16

Directory.Build.targets

Provides two shared behaviors:

  1. NuGet packaging — Packable projects automatically include README.md and LICENSE in the package.
  2. Coverage threshold enforcement — Test projects must define CoverageThreshold; the build fails if this property is missing.

Sources: Directory.Build.targets:1-18

EditorConfig

The .editorconfig enforces C# style rules including:

  • File-scoped namespaces (error severity)
  • Explicit accessibility modifiers (error severity)
  • No unused using directives (error severity)
  • Allman brace style
  • UTF-8 encoding with CRLF line endings

Sources: .editorconfig:1-30

Artifacts Directory (.artifacts/)

The .artifacts/ directory contains build outputs organized by purpose:

Subdirectory Contents
packages/ NuGet packages (.nupkg, .snupkg)
benchmark-output/ BenchmarkDotNet result files
test-output/ Test result artifacts
generated-inspect/ Generated source inspection files
benchmarks/ Benchmark build outputs

NuGet Package Configuration

All four source projects under src/ are configured as NuGet packages:

Property Value
Authors Garume
License MIT
Repository https://github.com/Garume/Manifold
Symbol packages .snupkg format (except Manifold.Generators)
Package tags cli, mcp, source-generator, dotnet, developer-tools

The Manifold.Generators package is structured differently from the other three: its compiled DLL is placed in analyzers/dotnet/cs/ within the NuGet package (as required for source generators), and a placeholder _._ file is placed in lib/netstandard2.0/ to satisfy NuGet conventions without shipping a runtime assembly.

<None Include="_._" Pack="true"
      PackagePath="lib/netstandard2.0" Visible="false" />
<None Include="$(OutputPath)$(AssemblyName).dll" Pack="true"
      PackagePath="analyzers/dotnet/cs" Visible="false" />

Sources: Manifold.Generators.csproj:30-44, Manifold.csproj:6-18

Tooling Summary

flowchart TD
    SDK[".NET SDK 10.0.101"]
    Lang["C# Latest"]
    Roslyn["Roslyn 4.14.0"]
    XUnit["xUnit v3 + MTP"]
    BDN["BenchmarkDotNet 0.15.8"]
    Coverlet["coverlet.MTP 8.0.0"]
    PS["PowerShell Scripts"]
    GHA["GitHub Actions"]
    EdCfg[".editorconfig"]
    NuGet["NuGet Packaging"]

    SDK --> Lang
    SDK --> Roslyn
    Roslyn --> |"Source Generation"| MG["Manifold.Generators"]
    Lang --> |"Build"| PS
    PS --> |"CI/CD"| GHA
    XUnit --> |"Testing"| Coverlet
    BDN --> |"Benchmarks"| PS
    EdCfg --> |"Code Style"| PS
    PS --> |"Pack"| NuGet
Loading
Tool Version/Details Purpose
.NET SDK 10.0.101 Build, test, pack
C# Language Latest (via LangVersion) Source language
Roslyn 4.14.0 Source generation compilation API
xUnit v3 (3.2.2) Test framework
Microsoft Testing Platform Enabled via global.json Test runner
coverlet 8.0.0 (MTP variant) Code coverage
BenchmarkDotNet 0.15.8 Performance benchmarking
PowerShell Cross-platform Build automation
GitHub Actions ci.yml, publish.yml CI/CD pipelines
EditorConfig Repository root Code style enforcement
NuGet Lock files enabled Package management

Related Pages

⚠️ **GitHub.com Fallback** ⚠️