Spec-First Pipeline

The SEA™ development process is spec-first: requirements drive design, design drives DSL, DSL drives code generation.

1
ADR → PRD → SDS → SEA™ → AST → IR → manifest → codegen

1. ADR (Architecture Decision Record)

Path: docs/specs/<ctx>/<ctx>.adr.md

Section Purpose
Context Problem domain, forces at play
Decision Chosen approach (DDD, CQRS, etc.)
Rationale Why this decision
Constraints MUST/MUST NOT rules for generators
Quality Attributes NFRs (latency, consistency)
Consequences Trade-offs, complexity

2. PRD (Product Requirements)

Path: docs/specs/<ctx>/<ctx>.prd.md


3. SDS (Software Design Spec)

Path: docs/specs/<ctx>/<ctx>.sds.yaml

Machine-readable design including:

Validate: python tools/validate_sds.py <sds.yaml>


4. SEA-DSL

Path: docs/specs/<ctx>/<ctx>.sea

Translate SDS into SEA-DSL:

See: flow-annotations.md


5. Compilation Pipeline

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Validate SEA™
sea validate docs/specs/<ctx>/<ctx>.sea

# Parse to AST
sea parse --format json docs/specs/<ctx>/<ctx>.sea > <ctx>.ast.json

# AST → IR
python tools/ast_to_ir.py <ctx>.ast.json <ctx>.ir.json

# IR → Manifest
python tools/ir_to_manifest.py <ctx>.ir.json <ctx>.manifest.json

# Manifest → Generated Code
python tools/codegen/gen.py <ctx>.manifest.json

# Determinism check
python tools/regen_check.py <ctx>.manifest.json

6. Nx Targets

Per bounded context, define targets in project.json:

Target Command
sds-validate python tools/validate_sds.py ...
sea-validate sea validate ...
sea-ast sea parse --format json ...
ast-to-ir python tools/ast_to_ir.py ...
ir-to-manifest python tools/ir_to_manifest.py ...
codegen python tools/codegen/gen.py ...
regen-check python tools/regen_check.py ...

Run all:

1
2
nx run specs-<ctx>:codegen
nx run-many -t codegen