feat: WP-0005 — diagram renderer integration (Mermaid, Graphviz, PlantUML)

Add pluggable DiagramRenderer protocol and RendererResult type to diagrams.py.
Implement MermaidRenderer (mmdc), GraphvizRenderer (dot), PlantUMLRenderer
backends with graceful source-only fallback and WarningRecord on missing tool
(FR-533, FR-534, FR-538). Builder detects renderers at build time and embeds
PNG with alt-text source marker for round-trip. Extend regression corpus with
rendered_diagrams_document.md and skipif-gated integration tests. All 272 tests
pass; ruff and mypy clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 12:16:09 +00:00
parent 0ff234b93f
commit 5564747060
6 changed files with 615 additions and 99 deletions

View File

@@ -0,0 +1,39 @@
# Document with Rendered Diagrams
This document is used for rendered-diagram round-trip regression (WP-0005 T05).
Each block exercises a different renderer backend.
## Mermaid State Machine
```mermaid
stateDiagram-v2
[*] --> Idle
Idle --> Active: start
Active --> Done: complete
Done --> [*]
```
## Graphviz Dependency Graph
```graphviz
digraph deps {
A -> B;
A -> C;
B -> D;
C -> D;
}
```
## PlantUML Sequence
```plantuml
@startuml
Alice -> Bob: Request
Bob --> Alice: Response
@enduml
```
## Summary
All three diagram types tested in rendered mode when tools are available,
source-only mode when they are not.