# Implementation Status (/docs/architecture/legacy-drafts/11-implementation-status)



# Implementation Status [#implementation-status]

This document tracks the current implementation status of the Modeller domain definition system.

*Last updated: 22 May 2026*

***

## Overview [#overview]

| Component                       | Status        | Location                                     |
| ------------------------------- | ------------- | -------------------------------------------- |
| **DSL Parser**                  | ✅ Complete    | `src/Modeller.Parser/`                       |
| **Domain Models**               | ✅ Complete    | `src/Modeller.Domain/`                       |
| **Configuration System**        | ✅ Complete    | `src/Modeller.Generator/Configuration/`      |
| **Code Generation Engine**      | ✅ Complete    | `src/Modeller.Generator/`                    |
| **CLI Tool**                    | ✅ Complete    | `src/Modeller.Cli/`                          |
| **Template Packs (C#)**         | ✅ Complete    | `templates/csharp/`                          |
| **VS Code Extension**           | ✅ Complete    | `editors/vscode-modeller/`                   |
| **Sample Definitions**          | ✅ Complete    | `samples/`                                   |
| **Integration Tests**           | ✅ Complete    | `tests/Modeller.Integration.Tests/`          |
| **CI Pipeline**                 | ✅ Complete    | `.github/workflows/`                         |
| **NuGet Publish**               | ⏳ Not Started | Package configured; not yet published        |
| **VS Code Marketplace Publish** | ⏳ Not Started | Extension packaged; publisher account needed |
| **Workflow DSL Support**        | ⏳ Not Started | —                                            |

***

## DSL Parser [#dsl-parser]

**Technology**: [Pidgin](https://github.com/benjamin-hodgson/Pidgin) v3.5.1 parser combinators

**Supported File Types**:

| Extension     | Parser                        | Description             |
| ------------- | ----------------------------- | ----------------------- |
| `.def`        | `DslParser.ParseDomain()`     | Domain definition       |
| `.entity`     | `DslParser.ParseEntity()`     | Entity definitions      |
| `.value`      | `DslParser.ParseValue()`      | Value objects           |
| `.shared`     | `DslParser.ParseShared()`     | Lookup/reference data   |
| `.enum`       | `DslParser.ParseEnum()`       | Enumerations            |
| `.flags`      | `DslParser.ParseEnum()`       | Flag enumerations       |
| `.command`    | `DslParser.ParseCommand()`    | Commands (write ops)    |
| `.query`      | `DslParser.ParseQuery()`      | Queries (read ops)      |
| `.event`      | `DslParser.ParseEvent()`      | Domain events           |
| `.key`        | `DslParser.ParseKey()`        | Key definitions         |
| `.service`    | `DslParser.ParseService()`    | Service/bounded context |
| `.projection` | `DslParser.ParseProjection()` | Read model projections  |

***

## Domain Models [#domain-models]

**Pattern**: Immutable records with factory method validation

**Key Design Decisions**:

1. Internal constructors prevent invalid object creation
2. Factory methods (`New`, `CreateValid`) validate before construction
3. `{ get; }` properties ensure true immutability
4. `Guid.IsVersion7()` extension validates public IDs

**Core Types**:

| Type           | Description                           |
| -------------- | ------------------------------------- |
| `Domain`       | Top-level container for entire domain |
| `Service`      | Bounded context grouping              |
| `Entity`       | Domain object with identity           |
| `Attribute`    | Property/field on an entity           |
| `Relationship` | Link between entities                 |
| `Enumeration`  | Enum type definition                  |
| `Command`      | Write operation                       |
| `Query`        | Read operation                        |

**Builder**: `DomainBuilder` converts parsed AST nodes into semantic domain model.

***

## Configuration System [#configuration-system]

**Technology**: YamlDotNet v17.1.0

**Structure**:

```
.modeller/
├── config.yaml          # Project-wide config (domain path, output root, variables)
└── profiles/
    ├── default.yaml     # Default generation profile
    ├── infrastructure.yaml
    └── plugin.yaml
```

**Key Classes**:

* `ConfigLoader` — loads `config.yaml` and profile YAMLs
* `ManifestLoader` — loads `pack.yaml` and `template.yaml` manifests
* `VariableMerger` — resolves `{variables.x}` substitutions in output paths
* `ProjectConfig`, `ProfileConfig` — typed configuration records

***

## Code Generation Engine [#code-generation-engine]

**Technology**: Scriban v7.2.0

**Generation Cardinality** (set in `template.yaml`):

* `per: domain` — one output file for the entire domain
* `per: entity` — one output file per entity in the domain

**Key Classes**:

* `GenerationPlanner` — reads profiles and builds a `GenerationPlan`
* `GenerationExecutor` — executes the plan, calls `TemplateEngine` per file
* `TemplateEngine` — wraps Scriban, passes domain model as context
* `DomainTemplateFunctions` — custom functions available inside templates (`pascal_case`, etc.)
* `ScribanDomainGenerator` — high-level facade used by the CLI

***

## CLI Tool [#cli-tool]

**Technology**: System.CommandLine v2.0.8\
**Distribution**: .NET global tool (`dotnet tool install --global Modeller.Cli`)

| Command     | Description                                                              |
| ----------- | ------------------------------------------------------------------------ |
| `init`      | Scaffold a `.modeller/` folder, copy sample definitions and LLM context  |
| `generate`  | Run the full generation pipeline from domain definitions to output files |
| `validate`  | Parse and validate domain definitions without generating output          |
| `templates` | List available template packs                                            |
| `snippet`   | Work with reusable code snippets                                         |

***

## Template Packs [#template-packs]

All packs live under `templates/csharp/`.

### `domain` [#domain]

Generates bare C# records for entities, enums, commands, and queries.

### `clean-architecture` [#clean-architecture]

Multi-template pack organised by clean architecture layers.

### `plugin` [#plugin]

Newest pack — generates a full plugin-architecture application:

| Sub-pack         | Key outputs                                                                                     |
| ---------------- | ----------------------------------------------------------------------------------------------- |
| `api`            | `Program.g.cs`, DI extensions, endpoint extensions, per-entity Minimal API endpoints, `.csproj` |
| `infrastructure` | `DbContext`, entity configurations, mapping extensions                                          |
| `sdk`            | `ApiResult`, `CreateRequest`, `UpdateRequest`, and other client types                           |
| `ui`             | UI layer scaffolding                                                                            |

***

## VS Code Extension [#vs-code-extension]

**Location**: `editors/vscode-modeller/`

**Features**:

* ✅ Syntax highlighting (TextMate grammar)
* ✅ Custom file icons for all 12 definition types
* ✅ Language configuration (comments, brackets, auto-close pairs)
* ✅ Auto-prompt to activate icon theme on first install

**Installation**: See `editors/vscode-modeller/INSTALL.md`

**Status**: Built and installable locally; not yet published to the VS Code Marketplace.

***

## Sample Definitions [#sample-definitions]

**`samples/modeller/`** — The Modeller tool's own domain, demonstrating all definition types.

**`samples/child-care/`** — Canonical reference project with a comprehensive Child Care domain and complete `.modeller/` configuration.

***

## Tests [#tests]

| Project                      | Tests | Coverage                                                                                               |
| ---------------------------- | ----- | ------------------------------------------------------------------------------------------------------ |
| `Modeller.Parser.Tests`      | 43    | Unit tests for all 12 DSL parsers                                                                      |
| `Modeller.Generator.Tests`   | 42    | Unit tests for config loading, manifest loading, variable merging, template discovery, snippet loading |
| `Modeller.Integration.Tests` | 84    | End-to-end generation (all plugin layers), domain assembly, DSL parsing for both sample domains        |

***

## Known Gaps [#known-gaps]

1. **Workflow DSL** — `workflow` is described in architecture docs but has no parser or generator support.
2. **NuGet publish** — the global tool package is not yet published to NuGet.org.
3. **VS Code Marketplace** — the extension is packaged and ready; a publisher account (`catalyst`) is needed to publish.
4. **Non-C# templates** — only C# template packs exist; the engine is language-agnostic.
