From 4dbda0209e9e2f7b35642ad3ec1a0cef91125716 Mon Sep 17 00:00:00 2001 From: danny Date: Thu, 25 Dec 2025 10:22:27 +0000 Subject: [PATCH] Add Mermaid preflight + Dave Factor callouts --- README.md | 9 + docs/APP_SPEC.md | 11 +- docs/HANDOFF.md | 10 +- .../AI-Code-Guardrails.shadow.dave.md | 21 ++ src/revoice/cli.py | 49 +++ src/revoice/generate.py | 60 ++++ style_bibles/IF.DAVE.BIBLE.md | 13 + tools/mermaid/mermaid-self-heal.js | 315 ++++++++++++++++++ tools/mermaid/mermaid-validate-worker.js | 137 ++++++++ 9 files changed, 623 insertions(+), 2 deletions(-) create mode 100644 tools/mermaid/mermaid-self-heal.js create mode 100644 tools/mermaid/mermaid-validate-worker.js diff --git a/README.md b/README.md index d3067b9..d909c62 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,15 @@ PYTHONPATH=src python3 -m revoice generate \ --output examples/ai-code-guardrails/AI-Code-Guardrails.shadow.dave.md ``` +Preflight the generated Markdown for PDF export (auto-fix Mermaid + lint): + +```bash +PYTHONPATH=src python3 -m revoice preflight \ + --style if.dave.v1.2 \ + --input examples/ai-code-guardrails/AI-Code-Guardrails.shadow.dave.md \ + --source examples/ai-code-guardrails/AI-Code-Guardrails.pdf +``` + Or install the CLI locally: ```bash diff --git a/docs/APP_SPEC.md b/docs/APP_SPEC.md index 39e537e..cd4f84b 100644 --- a/docs/APP_SPEC.md +++ b/docs/APP_SPEC.md @@ -74,6 +74,16 @@ Run a deterministic linter per bible: If lint fails: auto-repair pass (LLM) or return “needs revision” with lint report. +### 5b) Mermaid preflight (PDF export reliability) + +If the output includes Mermaid diagrams, run a preflight pass before PDF export: +- auto-heal Mermaid blocks (quote labels, normalize headers, balance `subgraph/end`) +- validate Mermaid rendering in the same runtime used by the PDF exporter + +In `re-voice`, this is exposed as: + +`revoice preflight --style