generated from coulomb/repo-seed
80 lines
1.7 KiB
Markdown
80 lines
1.7 KiB
Markdown
# Content Classes
|
|
|
|
Date: 2026-05-04
|
|
|
|
## Purpose
|
|
|
|
Content classes are data-defined composition rules for reusable document
|
|
structures, overlays, and variants. They are not Python inheritance. They are a
|
|
deterministic way to combine slots such as sections, assertions, snippets,
|
|
processors, and style guidance.
|
|
|
|
This is the P10.7 resolver spike for future class/object-style workflows.
|
|
|
|
## Model
|
|
|
|
A class can declare:
|
|
|
|
- `extends`: parent classes
|
|
- `slots`: structured values to contribute
|
|
- `merge_policies`: per-slot merge behavior
|
|
|
|
Example:
|
|
|
|
```yaml
|
|
classes:
|
|
base-prd:
|
|
slots:
|
|
sections:
|
|
- Problem
|
|
- Decision
|
|
enterprise:
|
|
extends:
|
|
- base-prd
|
|
slots:
|
|
sections:
|
|
- Compliance
|
|
merge_policies:
|
|
sections: append
|
|
```
|
|
|
|
## Linearization
|
|
|
|
Multiple inheritance uses a C3-style linearization. That gives us:
|
|
|
|
- deterministic parent ordering
|
|
- monotonic inheritance behavior
|
|
- explicit diagnostics for cycles, unknown parents, and inconsistent precedence
|
|
|
|
The resolved class is merged from base to leaf according to the computed
|
|
linearization.
|
|
|
|
## Merge Policies
|
|
|
|
Initial policies:
|
|
|
|
- `replace`
|
|
- `append`
|
|
- `prepend`
|
|
- `deep_merge`
|
|
- `error_on_conflict`
|
|
|
|
Unknown policies and invalid value shapes produce diagnostics.
|
|
|
|
## CLI
|
|
|
|
Resolve a class:
|
|
|
|
```bash
|
|
mkt class resolve examples/classes/prd-classes.yaml enterprise-prd
|
|
```
|
|
|
|
JSON/YAML output includes the linearization, merged slots, and diagnostics.
|
|
|
|
## Extension Boundary
|
|
|
|
The current resolver does not yet instantiate Markdown documents or inject
|
|
snippets. It establishes the deterministic inheritance and merge floor. Later
|
|
work can connect resolved slots to contracts, references, processors, and
|
|
generation plans.
|