Skip to content

Project Structure

viamu edited this page Mar 1, 2026 · 3 revisions

πŸ—οΈ Project Structure

Architecture Overview

graph TD
    CLI[Cli Layer] --> P[Pipeline Layer]
    P --> S[Steps Layer]
    S --> CL[Claude Layer]
    P --> CF[Config Layer]
    P --> UI[UI Layer]

    CLI --> |RunCommand<br/>RunPipelineCommand| P
    P --> |PipelineExecutor<br/>PipelineContext| S
    S --> |DynamicStep<br/>ForeachStep<br/>ParallelStep<br/>UsePipelineStep| CL
    CL --> |ClaudeCliRunner<br/>IClaudeRunner| EXT["☁️ Claude Code CLI"]
Loading

πŸ“ Source Tree

code-genesis/
β”‚
β”œβ”€β”€ πŸ“„ Solution.slnx
β”œβ”€β”€ πŸ“„ README.md
β”œβ”€β”€ πŸ“„ global.json                         # Pins .NET SDK version (10.0.103)
β”‚
β”œβ”€β”€ πŸ”§ .github/
β”‚   └── workflows/
β”‚       └── ci.yml                          # GitHub Actions CI pipeline
β”‚
β”œβ”€β”€ πŸ“ examples/
β”‚   β”œβ”€β”€ hello-world.yml                     # Sample pipeline
β”‚   β”œβ”€β”€ foreach-parallel.yml                # Foreach + parallel demo
β”‚   β”œβ”€β”€ parallel-foreach.yml                # Parallel foreach demo
β”‚   β”œβ”€β”€ approval.yml                        # Approval step demo
β”‚   β”œβ”€β”€ fail-if-step.yml                    # fail_if post-check demo
β”‚   β”œβ”€β”€ use-pipeline/                       # Pipeline composition demo
β”‚   β”‚   β”œβ”€β”€ main.yml                        # Parent pipeline
β”‚   β”‚   └── analysis.yml                    # Reusable child pipeline
β”‚   └── contexts/planner/                   # Sample context bundle
β”‚
β”œβ”€β”€ 🧬 CodeGenesis.Engine/                  # Main project
β”‚   β”œβ”€β”€ Program.cs                          # Entry point, DI, Serilog, Spectre CLI
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ€– Claude/                          # Claude CLI integration
β”‚   β”‚   β”œβ”€β”€ IClaudeRunner.cs                # Abstraction for testability
β”‚   β”‚   β”œβ”€β”€ ClaudeCliRunner.cs              # Spawns claude --print processes
β”‚   β”‚   β”œβ”€β”€ ClaudeCliOptions.cs             # Configuration POCO
β”‚   β”‚   β”œβ”€β”€ ClaudeRequest.cs                # Request model
β”‚   β”‚   └── ClaudeResponse.cs               # Response model + JSON parsing
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ’» Cli/                             # CLI commands
β”‚   β”‚   β”œβ”€β”€ RunCommand.cs                   # run (hardcoded pipeline)
β”‚   β”‚   └── RunPipelineCommand.cs           # run-pipeline (YAML-driven)
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“‹ Config/                          # Configuration & models
β”‚   β”‚   β”œβ”€β”€ PipelineConfig.cs               # YAML deserialization models
β”‚   β”‚   β”œβ”€β”€ PipelineConfigLoader.cs         # YAML loader + template resolver
β”‚   β”‚   β”œβ”€β”€ ContextBundleLoader.cs          # Context bundles from directories
β”‚   β”‚   β”œβ”€β”€ AgentDefinition.cs              # Agent config model
β”‚   β”‚   β”œβ”€β”€ McpServerConfig.cs              # MCP stdio server config
β”‚   β”‚   β”œβ”€β”€ McpContextBuilder.cs            # Builds MCP tools section for system prompt
β”‚   β”‚   └── MarkdownFrontmatterParser.cs    # YAML frontmatter from .md files
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ”„ Pipeline/                        # Core pipeline framework
β”‚   β”‚   β”œβ”€β”€ PipelineExecutor.cs             # Runs steps sequentially
β”‚   β”‚   β”œβ”€β”€ PipelineContext.cs              # Shared state between steps
β”‚   β”‚   β”œβ”€β”€ IPipelineStep.cs                # Step interface
β”‚   β”‚   β”œβ”€β”€ IStepExecutor.cs                # Interface for recursive execution
β”‚   β”‚   β”œβ”€β”€ CollectionParser.cs             # JSON/CSV/newline collections
β”‚   β”‚   β”œβ”€β”€ StepResult.cs                   # Step output model
β”‚   β”‚   β”œβ”€β”€ RetryPolicy.cs                  # Retry configuration resolution
β”‚   β”‚   └── CheckpointManager.cs            # Resume/checkpoint persistence
β”‚   β”‚
β”‚   β”œβ”€β”€ ⚑ Steps/                            # Step implementations
β”‚   β”‚   β”œβ”€β”€ DynamicStep.cs                  # YAML-driven dynamic step
β”‚   β”‚   β”œβ”€β”€ ForeachStep.cs                  # Sequential iteration
β”‚   β”‚   β”œβ”€β”€ ParallelStep.cs                 # Concurrent branches
β”‚   β”‚   β”œβ”€β”€ ParallelForeachStep.cs          # Concurrent iteration
β”‚   β”‚   β”œβ”€β”€ ApprovalStep.cs                 # Interactive approval
β”‚   β”‚   β”œβ”€β”€ UsePipelineStep.cs              # Pipeline composition (sub-pipeline)
β”‚   β”‚   β”œβ”€β”€ StepBuilder.cs                  # Builds step trees from YAML
β”‚   β”‚   β”œβ”€β”€ PlanStep.cs                     # Built-in planning step
β”‚   β”‚   β”œβ”€β”€ ExecuteStep.cs                  # Built-in execution step
β”‚   β”‚   └── ValidateStep.cs                 # Built-in validation step
β”‚   β”‚
β”‚   └── 🎨 UI/                              # Console rendering
β”‚       β”œβ”€β”€ PipelineRenderer.cs             # Spectre.Console output
β”‚       └── ConsoleTheme.cs                 # Theme constants
β”‚
└── πŸ§ͺ CodeGenesis.Engine.Tests/            # Unit tests
    β”œβ”€β”€ Claude/
    β”‚   └── ClaudeResponseTests.cs
    β”œβ”€β”€ Config/
    β”‚   β”œβ”€β”€ McpServerConfigTests.cs
    β”‚   β”œβ”€β”€ McpContextBuilderTests.cs
    β”‚   β”œβ”€β”€ PipelineConfigLoaderTests.cs
    β”‚   └── StepEntryTests.cs
    β”œβ”€β”€ Pipeline/
    β”‚   β”œβ”€β”€ CollectionParserTests.cs
    β”‚   β”œβ”€β”€ PipelineContextTests.cs
    β”‚   β”œβ”€β”€ RetryPolicyTests.cs
    β”‚   └── StepResultTests.cs
    └── Steps/
        β”œβ”€β”€ DynamicStepTests.cs
        └── UsePipelineStepTests.cs

🧱 Key Design Patterns

Pattern Where Description
Dependency Injection Program.cs All services registered via Microsoft.Extensions.DependencyInjection
Template Resolution PipelineConfigLoader {{variable}} syntax resolved before each step
Step Composition StepBuilder Recursive tree built from YAML config
Async/Cancellation All steps CancellationToken propagated, Ctrl+C handled
Retry with Backoff DynamicStep Configurable retry for timeouts, rate limit pauses for 429s
Interface Abstraction IClaudeRunner, IStepExecutor Enables unit testing with mocks

🧬 CodeGenesis

🏠 Home


πŸ“˜ Guides

πŸ“‹ Pipeline

πŸ”§ Internals


CI

Clone this wiki locally