Plan: 200-Page CMF Technical Document
Context
What: A comprehensive professional-grade technical document (~200 pages) combining DDD, Feature Tracking, TDD, and CMF into one cohesive system. Written for developers and enterprise tech companies (Schneider, etc.).
Approach: Start with Feature Tracking (what are the expected features of a CMF?), then use DDD to model it, TDD to verify it, and source generation to build it. The CMF's own requirements are expressed using the Requirements DSL notation -- this serves as both a specification document AND the first real-world validation that the DSL design works for a non-trivial project. This is not self-hosting: the DSL doesn't exist yet when we write these requirements. True dog-fooding (bootstrapping the CMF with itself) is a future milestone the document addresses explicitly.
Deliverable: Chapter files in content/blog/cmf/
Scope: This is a design document / technical whitepaper for the CV portfolio. Nothing is implemented.
Document Structure (~200 pages, 12 parts)
Part I: Vision (10 pages)
- What is a CMF vs CMS
- The Diem Project origin story (2010 PHP → 2026 C#)
- Why "Requirements as Code" + TDD + DDD + Source Generation
- Target audience: enterprise teams building domain-specific content platforms
Part II: CMF Feature Catalog -- Requirements as Code (25 pages)
The CMF's requirements expressed using the Requirements DSL notation -- validating the DSL design against a real-world project before the DSL itself is built. Addresses the bootstrap question: once built, could the CMF redefine its own requirements using its own tooling?
6 Epics → ~30 Features → ~80 Stories → ~150 Tasks (4 levels deep):
Epic: DomainModelingEpic -- model entities, generate persistence
- Feature: AggregateDefinition (AC: define root, add entities, add VOs)
- Story: DefineAggregateRoot → Tasks: scaffold class, add EntityId, validate constraints
- Story: AddComposition → Tasks: entity composition, VO composition, collection support
- Story: GenerateEfCore → Tasks: DbContext, migrations, repository
- Feature: CqrsGeneration (AC: commands, events, handlers, sagas)
- Feature: BuilderGeneration (AC: fluent builder, immutable construction)
- Feature: InvariantEnforcement (AC: [Invariant] methods returning Result, generated EnsureInvariants(), called after every command)
- Feature: ValidationGeneration (AC: property validation, cross-entity rules)
- Feature: AggregateDefinition (AC: define root, add entities, add VOs)
Epic: ContentManagementEpic -- parts, blocks, StreamFields
- Feature: ContentParts (AC: define part, attach to entity, version)
- Feature: ContentBlocks (AC: struct blocks, list blocks, nesting)
- Feature: StreamFields (AC: compose blocks, order, JSON serialization)
Epic: AdminGenerationEpic -- auto-CRUD from schema
- Feature: ListGeneration (AC: paginated list, filters, sorting)
- Feature: FormGeneration (AC: create/edit forms, validation, nested entities)
- Feature: BatchActions (AC: bulk operations, confirmation)
Epic: PageCompositionEpic -- layouts, zones, widgets
- Feature: PageTree (AC: hierarchical pages, slugs, materialized paths)
- Feature: WidgetSystem (AC: define widget, config, placement)
- Feature: DynamicRouting (AC: URL resolution, SEO)
Epic: WorkflowEpic -- editorial pipelines
- Feature: StateMachine (AC: stages, transitions, guards)
- Feature: LocaleTracking (AC: per-locale progress)
- Feature: ScheduledPublishing (AC: timed transitions)
Epic: RequirementsTrackingEpic -- the chain itself
- Feature: TypeSafeChain (AC: Requirements→Specs→Impl→Tests)
- Feature: RoslynAnalyzers (AC: REQ1xx-REQ4xx diagnostics)
- Feature: QualityGatesIntegration (AC: CMF build uses
dotnet quality-gatesto enforce its own pass rate, coverage, fuzz testing -- the tool already exists, this feature is about wiring it into the CMF's CI pipeline)
Note: dotnet quality-gates is a pre-existing tool, not something the CMF builds. The CMF consumes it to validate its own requirements chain. This is analogous to using NUnit -- you don't build NUnit, you use it.
Each feature includes full abstract record + AC methods in C# code. Full hierarchy mermaid diagram showing all 6 epics and their features.
Part III: Meta-Metamodel Foundation -- M3 (15 pages)
- The 4-layer hierarchy (M0-M3) from OMG MOF
- MetaConcept, MetaProperty, MetaReference, MetaConstraint, MetaInherits
- Self-describing fixed point
- How M2 DSLs are built on M3
- Mermaid: M3 → M2 → M1 → M0 flow
- Mermaid: MetaConcept class diagram
Part IV: DDD DSL -- Domain Modeling (30 pages)
- AggregateRoot, Entity, EntityId, ValueObject
- Composition vs Association vs Aggregation semantics
- BoundedContext and MappingContext
- Command, DomainEvent, Query, Saga
- Aggregate Invariants via
[Invariant]on methods returningResult:[AggregateRoot] public partial class Order { [Composition] public partial IReadOnlyList<OrderLine> Lines { get; } [Composition] public partial Money Total { get; } [Invariant("Order must have at least one line")] private Result HasLines() => Lines.Count > 0 ? Result.Success() : Result.Failure("Order must have at least one line"); [Invariant("Total must match sum of lines")] private Result TotalMatchesLines() => Total.Amount == Lines.Sum(l => l.UnitPrice.Amount * l.Quantity) ? Result.Success() : Result.Failure($"Total {Total.Amount} != sum {Lines.Sum(...)}"); [Invariant("Total must be positive")] private Result TotalIsPositive() => Total.Amount > 0 ? Result.Success() : Result.Failure($"Total {Total.Amount} is not positive"); } // Source-generated: called after every command handler // Generated: EnsureInvariants() public Result EnsureInvariants() { return Result.Aggregate( HasLines(), TotalMatchesLines(), TotalIsPositive() ); }[AggregateRoot] public partial class Order { [Composition] public partial IReadOnlyList<OrderLine> Lines { get; } [Composition] public partial Money Total { get; } [Invariant("Order must have at least one line")] private Result HasLines() => Lines.Count > 0 ? Result.Success() : Result.Failure("Order must have at least one line"); [Invariant("Total must match sum of lines")] private Result TotalMatchesLines() => Total.Amount == Lines.Sum(l => l.UnitPrice.Amount * l.Quantity) ? Result.Success() : Result.Failure($"Total {Total.Amount} != sum {Lines.Sum(...)}"); [Invariant("Total must be positive")] private Result TotalIsPositive() => Total.Amount > 0 ? Result.Success() : Result.Failure($"Total {Total.Amount} is not positive"); } // Source-generated: called after every command handler // Generated: EnsureInvariants() public Result EnsureInvariants() { return Result.Aggregate( HasLines(), TotalMatchesLines(), TotalIsPositive() ); }- Generator discovers all
[Invariant]methods → emitsEnsureInvariants()that calls each and aggregates Results EnsureInvariants()injected into every generated command handler (after state mutation, before SaveChanges)- Result pattern means invariants report why they failed, support multiple simultaneous failures
- Invariants are also callable in tests:
order.EnsureInvariants().IsSuccess.Should().BeTrue() - Analyzer:
DDD100warning if aggregate has zero[Invariant]methods
- Generator discovers all
- Source-generated: entities, builders, validators, EF Core, repos
- Compile-time constraints (every entity reachable via Composition, etc.)
- Full Order aggregate example with generated code
- Mermaid: aggregate boundary diagram
- Mermaid: composition → EF Core mapping
- Mermaid: CQRS flow (Command → Handler → EnsureInvariants → Event → Projection)
Part V: Content DSL -- Content Parts & Blocks (15 pages)
- ContentPart (horizontal composition: Routable, Seoable, Taggable)
- ContentBlock (vertical composition: Hero, Testimonial, RichText)
- StreamField (composable sequences)
- Versioning, draft/publish
- Source-generated: JSON serialization, admin fields, API schema
- Mermaid: part vs block composition diagram
Part VI: Admin DSL -- Auto-Generated UI (10 pages)
- AdminModule, AdminField, AdminFilter, AdminAction
- Generated Blazor components (list, form, detail, batch)
- Requirement-enriched admin (compliance dashboard)
- Mermaid: admin generation pipeline
Part VII: Pages DSL -- Dynamic Page Composition (10 pages)
- Page tree, Layout, Zone, WidgetInstance
- PageWidget, WidgetConfig
- Dynamic routing from materialized paths
- Blazor WASM SPA + API
- Mermaid: page → layout → zone → widget hierarchy
Part VIII: Workflow DSL -- Editorial Pipelines (10 pages)
- Workflow, Stage, Transition, Gate, RequiresRole
- ForEachLocale (per-locale tracking)
- ScheduledTransition
- Generated state machine with guards
- Integration with Requirements (workflow gates check compliance)
- Mermaid: workflow state diagram
Part IX: Requirements DSL -- The Type-Safe Chain (25 pages)
- Requirements as abstract records with AC methods
- Specifications as interfaces
- Implementation satisfying specs (
: ISpec) - Tests with
typeof()+nameof() - SharedKernel for domain types
- Generated attributes (
[ForRequirement],[Verifies],[TestsFor]) - RequirementRegistry and TraceabilityMatrix
- IDE navigation chain
- Two runtime modes (normal + compliance)
- Mermaid: 6-project reference DAG
- Mermaid: traceability flow
Part X: Roslyn Analyzers & Quality Gates (15 pages)
- REQ1xx: requirement → specification coverage
- REQ2xx: specification → implementation coverage
- REQ3xx: implementation → test coverage
- REQ4xx: quality gates (pass rate, code coverage, duration, flakiness, fuzz testing)
dotnet quality-gates checktool- .editorconfig severity configuration
- CI pipeline (build → test → quality-gates)
- Mermaid: analyzer pipeline flow
Part XI: The .Design CLI + Interactive TUI (15 pages)
- Standard CLI (for CI/automation):
cmf new-- project scaffolding from templatescmf add aggregate/command/event/feature/saga-- code scaffoldingcmf generate-- run all pipeline stagescmf validate-- metamodel constraint checkingcmf migrate-- EF Core migrationscmf report requirements/traceability/coverage
- Interactive TUI (Spectre.Console, for developer experience):
cmf design-- launches interactive modeling session- Visual aggregate designer: select aggregate → add properties → preview EF Core mapping
- Feature wizard: define epic → features → stories → tasks with AC prompts
- Workflow builder: drag-and-drop stages, gates, transitions in terminal
- Live preview: see generated code as you model
- Requirement dashboard: compliance status, coverage, untested ACs
- Mermaid: TUI screen mockups (ASCII)
- Mermaid: CLI architecture diagram
Part XII: End-to-End Walkthrough (20 pages)
- Build an e-commerce CMF from scratch
- Define requirements (Feature Tracking)
- Model domain (DDD: Product, Order, Customer aggregates)
- Generate code (source generators)
- Add content (Content DSL: product pages with StreamFields)
- Build admin (Admin DSL: product management)
- Create pages (Pages DSL: catalog, product detail)
- Set up workflow (Workflow DSL: editorial approval)
- Write tests (TDD: type-linked)
- Run quality gates
- Deploy
- Mermaid: end-to-end sequence diagram
Mermaid Diagrams (~20 diagrams)
- M3 → M2 → M1 → M0 layer diagram
- MetaConcept class hierarchy
- CMF solution structure
- Five-stage generation pipeline
- DDD aggregate boundary (Order example)
- Composition → EF Core mapping
- CQRS command/event flow
- Content part vs block composition
- Admin generation pipeline
- Page → Layout → Zone → Widget hierarchy
- Workflow state machine
- Requirements 6-project reference DAG
- Traceability chain (Requirement → Spec → Impl → Test)
- Roslyn analyzer pipeline
- Quality gates flow
- CLI command architecture
- CI/CD pipeline
- Cross-DSL integration (all 6 DSLs on one diagram)
- End-to-end e-commerce walkthrough sequence
- CMF feature catalog hierarchy (Epics → Features → Stories)
Design Decisions (from user)
- File structure: Chapter files in
content/blog/cmf/folder (01-vision.md through 12-walkthrough.md + index) - CLI style: Interactive TUI with Spectre.Console (
cmf designlaunches interactive modeling) + standard CLI for CI/automation - Feature catalog depth: Epic → Feature → Story → Task (4 levels, ~100+ items, very thorough)
Files to Create
content/blog/cmf/
├── index.md ← TOC + introduction
├── 01-vision.md ← Part I: Vision (~10 pages)
├── 02-feature-catalog.md ← Part II: CMF Feature Catalog (~25 pages)
├── 03-meta-metamodel.md ← Part III: M3 Foundation (~15 pages)
├── 04-ddd-dsl.md ← Part IV: DDD DSL (~30 pages)
├── 05-content-dsl.md ← Part V: Content DSL (~15 pages)
├── 06-admin-dsl.md ← Part VI: Admin DSL (~10 pages)
├── 07-pages-dsl.md ← Part VII: Pages DSL (~10 pages)
├── 08-workflow-dsl.md ← Part VIII: Workflow DSL (~10 pages)
├── 09-requirements-dsl.md ← Part IX: Requirements DSL (~25 pages)
├── 10-analyzers.md ← Part X: Analyzers & Quality Gates (~15 pages)
├── 11-design-cli.md ← Part XI: The .Design CLI + TUI (~15 pages)
└── 12-walkthrough.md ← Part XII: End-to-End Walkthrough (~20 pages)content/blog/cmf/
├── index.md ← TOC + introduction
├── 01-vision.md ← Part I: Vision (~10 pages)
├── 02-feature-catalog.md ← Part II: CMF Feature Catalog (~25 pages)
├── 03-meta-metamodel.md ← Part III: M3 Foundation (~15 pages)
├── 04-ddd-dsl.md ← Part IV: DDD DSL (~30 pages)
├── 05-content-dsl.md ← Part V: Content DSL (~15 pages)
├── 06-admin-dsl.md ← Part VI: Admin DSL (~10 pages)
├── 07-pages-dsl.md ← Part VII: Pages DSL (~10 pages)
├── 08-workflow-dsl.md ← Part VIII: Workflow DSL (~10 pages)
├── 09-requirements-dsl.md ← Part IX: Requirements DSL (~25 pages)
├── 10-analyzers.md ← Part X: Analyzers & Quality Gates (~15 pages)
├── 11-design-cli.md ← Part XI: The .Design CLI + TUI (~15 pages)
└── 12-walkthrough.md ← Part XII: End-to-End Walkthrough (~20 pages)Also update toc.json to add the cmf/ section.
Files to Reference (read-only, content to merge/expand)
content/blog/content-management-framework.md-- existing CMF architecture (~2200 lines)content/blog/feature-tracking.md-- existing feature tracking chain (~1100 lines)content/blog/ddd.md-- existing DDD/modeling theorycontent/blog/modeling.md-- existing metamodeling theory
Approach
Write chapter files sequentially, one at a time. Each chapter is self-contained but cross-references others. Mermaid diagrams inline. Consistent C# examples throughout. Professional tone for enterprise audience.
Given the massive size (~200 pages ≈ ~12,000 lines total), implementation will proceed one chapter at a time in order.