Software Design Specification - Platform / Compiler Service
Proposed
The SEA™ Forge Delivery Pipeline Service is a multi-stage compilation system that orchestrates semantic validation, structural mapping, generator execution, and CI enforcement.
It behaves like a compiler toolchain, not a code editor.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Specs (ADR/PRD/SDS)
↓
Plan Compiler (Spec Kit)
↓
Semantic Compiler (DSL + g3)
↓
AST
↓
Manifest Compiler
↓
Generator Schema Compiler
↓
Generators (Nx / bespoke)
↓
Generated Code
↓
Validation + Drift Check
| Attribute | Value |
|---|---|
| Input | ADR/PRD/SDS |
| Output | plan.yaml |
| Handles | Waves, cycles, dependencies, branch naming |
Responsibility: Transform specifications into actionable delivery plans structured as waves of TDD cycles.
| Attribute | Value |
|---|---|
| Input | Specs + Plan |
| Output | SEA™ DSL models, AST |
| Validates | SEA™ DSL policies, CALM constraints |
Responsibility: Translate human-authored specifications into machine-readable semantic models.
| Attribute | Value |
|---|---|
| Input | AST |
| Output | Manifest(s) |
| Enforces | Architecture style mappings (e.g., Hexagonal) |
Responsibility: Map semantic AST to structural manifests that define code organization.
| Attribute | Value |
|---|---|
| Input | Manifest |
| Output | Nx generator configs, bespoke generator schemas |
Responsibility: Transform manifests into generator-specific input formats.
| Attribute | Value |
|---|---|
| Executes | Nx generators, bespoke generators |
| Writes to | Generated directories only |
| Produces | Regeneration hash for drift detection |
Responsibility: Execute code generators deterministically.
| Attribute | Value |
|---|---|
| Action | Re-runs generators |
| Compares | Output to committed state |
| On mismatch | Fails build |
Responsibility: Prevent unauthorized manual edits to generated code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
planVersion: "1.0"
release: "sprint-1"
waves:
- id: "wave-1"
name: "Foundation"
cycles:
- id: "cycle-1-1"
name: "Core Domain Models"
branch: "feat/wave-1/cycle-1-1-core-domain"
depends: []
specs:
- "SDS-002"
- id: "cycle-1-2"
name: "Repository Ports"
branch: "feat/wave-1/cycle-1-2-repo-ports"
depends: ["cycle-1-1"]
specs:
- "SDS-003"
1
2
3
4
5
6
7
8
overrideId: "override-001"
reason: "Stripe SDK requires manual binding"
scope:
- "libs/billing/adapters/stripe"
expiry: "2025-03-01"
backfillRef: "JIRA-1234"
approver: "tech-lead"
createdAt: "2025-01-15T10:00:00Z"
sequenceDiagram
participant Dev as Developer
participant Plan as Plan Compiler
participant Sem as Semantic Compiler
participant Man as Manifest Compiler
participant Gen as Generator Runner
participant CI as CI/CD Pipeline
Dev->>Plan: Author specs
Plan->>Plan: Generate plan.yaml
Plan->>Sem: Compile to SEA™ DSL
Sem->>Sem: Validate semantics
Sem->>Man: Generate AST
Man->>Man: Map to manifest
Man->>Gen: Compile generator inputs
Gen->>Gen: Execute generators
Gen->>CI: Generated code
CI->>CI: Run tests
CI->>CI: Drift check
CI->>Dev: Pass/Fail
| Resource | Read | Write |
|---|---|---|
| Specifications (ADR/PRD/SDS) | ✅ | ❌ (human only) |
| SEA™ DSL | ✅ | ✅ |
| Manifests | ✅ | ✅ |
| Generator Schemas | ✅ | ✅ |
| Generated Code | ✅ | ❌ |
readonly in .gitattributes1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
stages:
- stage: semantic-validate
command: sea semantic validate
gate: true
- stage: manifest-validate
command: sea manifest validate
gate: true
- stage: generate
command: sea generate
gate: true
- stage: test
command: npm test
gate: true
- stage: drift-check
command: sea drift check
gate: true
| Command | Purpose |
|---|---|
sea semantic validate |
Validate SEA™ DSL models |
sea manifest validate |
Validate manifest schemas |
sea generate |
Execute generators |
sea drift check |
Compare generated vs committed |
sea plan compile |
Generate delivery plan from specs |
| Event | Payload |
|---|---|
spec.authored |
Spec ID, author, timestamp |
plan.compiled |
Plan ID, wave count, cycle count |
semantic.validated |
Model hash, violations |
manifest.generated |
Manifest ID, DSL refs |
code.generated |
Output hash, generator version |
drift.detected |
File paths, expected vs actual hash |
| Failure | Response |
|---|---|
| Semantic error | Block pipeline |
| Generator error | Fail cycle |
| Drift detected | Fail merge |
| Manual override without record | Hard fail |
SEA™ Forge Delivery Pipeline is a governed compilation system, not an agent coding framework.
The code generator entrypoint tools/codegen/gen.py is a generated artifact defined by SDS-021.
Location: tools/codegen/gen.py
Purpose: Deterministically generates code from manifest.json files.
Required Parameters:
manifest.json path (positional argument)Behavioral Contract:
src/gen/ directories as defined in manifest outputRoots/src/gen/)Determinism Guarantees:
Generated Sections:
_ts_type, _py_type, etc.)The generator uses Jinja2 templates from tools/codegen/templates/:
Template Mapping:
| Layer | Template | Output |
|——-|———-|——–|
| Domain | entity.ts.jinja2 / entity.py.jinja2 | entities/* |
| Types | value_object.ts.jinja2 / enum.ts.jinja2 | types/* |
| Ports | port.ts.jinja2 / port.py.jinja2 | ports/* |
| Application | command.ts.jinja2 / query.ts.jinja2 | commands/, queries/ |
| Events | event.ts.jinja2 / event.py.jinja2 | events/* |
| Adapters | adapter.ts.jinja2 / adapter.py.jinja2 | adapters/* |
Custom Filters:
ts_type - Convert SDS type to TypeScriptpy_type - Convert SDS type to Pythonsnake_case - PascalCase to snake_caseparse_method_name, parse_method_params, parse_method_return - Method signature parsing