Website organization#
The public site has three primary destinations: Docs, Examples and Boring AWS. Docs groups getting started, guides, reference and contributing; /docs/diagram-types/ is the complete 32-type reference. /examples.html is the categorized entry point, /examples/diagrams/ indexes the original 19 and 23 scenario examples, and individual guides render as HTML. AWS reconstructions have their own /examples/aws/<id>/ pages. Before/after and the safety replay are workflow demonstrations. Boring AWS retains a distinct visual identity and individual diagram URLs.
scripts/site-catalogue.ts assembles the example index and guide pages from existing sources. The checked-in root examples.html currently supplies the shared shell and legacy curated content, retained at /examples/featured/; the deployed index is generated, not a direct copy. build-site.ts copies fixtures before generation, so raw source, image, evidence and legacy gallery URLs remain available. Do not inspect the repository root as if it were the assembled website.
docs/diagram-types.md is the checked-in reference snapshot generated by typeReference(); its synchronization is tested. Regenerate it after inventory changes. reading.css refines the documentation shell; site.css styles the homepage and example pages. Neither styles the artistic microsite. test/site-catalogue.test.ts checks type coverage, category discovery and every local page/asset destination in the assembled HTML.
Example prompts#
The assembled website adds prompts through scripts/build-example-prompts.ts, after all page generators finish. Original examples reuse their suggested requests with reference paths and capability boundaries; scenario examples use their authored descriptions; recipes, reconstructions, comparisons and safety cases have purpose-specific briefs. New text is labelled Suggested prompt, never presented as a recorded model run. Existing AWS walkthrough stage text and Boring AWS authoring briefs retain their wording and provenance. The type reference links to examples instead of duplicating prompts.
The prompt pass places each brief before its diagram and adds the reading sequence “1 · Prompt → 2 · Diagram”. Brief cards use a two-line preview and native collapsed disclosure; the full text remains the copy source. Boring AWS receives a lilac variant above its full-width viewer. example-prompts.js provides copy feedback and opens the disclosure before selecting text when clipboard access fails. Without JavaScript the brief remains readable and the copy control stays hidden. example-prompts.css scopes presentation without replacing the microsite identity. Repository paths assume a checkout; prompts are not exact reproduction commands. The saved Mermaid, action files and CLI commands remain authoritative for reproducing outputs. The site build does not call models, execute prompts, or rerecord receipts.
test/example-prompts.test.ts checks all detail pages, legacy galleries, homepage examples, recipe/replay cases and microsite briefs, plus copy success/failure and unchanged recorded evidence. Inspect the assembled dist/site, not the unenhanced authoring templates, when reviewing these controls.
Website preview#
Run bun run preview:site and open http://127.0.0.1:4173/. This assembles the homepage, examples, generated HTML documentation, and schemas together in dist/site, then serves them on localhost. Stop with Ctrl-C and rerun after changes. Do not use open index.html or serve the repository root to test documentation links: docs/ in the checkout contains Markdown, not the generated website.
bun run build:site builds the same directory without starting a server. It also regenerates the diagram gallery at /examples/recipes/diagram-types/ from the committed Mermaid sources. Run bun run build:gallery to refresh the committed HTML gallery and its Markdown guide after changing those sources or the website shell. GitHub Pages deploys this exact build path so local navigation and deployed navigation use the same routes.
Recorded mutation replay#
The local Don’t Break the Diagram microsite at /dont-break-the-diagram/ replays a supported architecture edit, an unsafe-label refusal, a stale-plan refusal, and an exact rollback. build:site assembles saved evidence only; it never executes mutations to build this route. To deliberately refresh the recording, run bun run build, bun scripts/record-diagram-safety.ts, and bun scripts/build-diagram-safety.ts, then inspect the generated sources, responses, receipts and SVGs. The recorder captures the executable checksum; temporary absolute paths in receipt snapshots are provenance, not portable resumable receipts. See the microsite README for reproduction and coverage limits.
Source-backed AWS reference fixtures#
examples/recipes/aws-reference-architectures/ reconstructs four published AWS references, with provenance, documented omissions and remaining measured geometry findings. After editing a source, run bun run build and bun scripts/build-aws-references.ts to regenerate SVG/PNG plus inspection/audit/hash evidence using the compiled executable. bun test test/aws-references.test.ts checks source/output synchronization and important reference semantics. These are examples, not a new architecture validator or automatic-polish capability.
Requirements#
- Bun 1.3 or newer
- TypeScript 5.9
- A supported resvg native target for PNG rendering
Setup#
bun install --frozen-lockfile
bun run check
bun test
Build#
bun run build
./dist/beautiflow version
The build command compiles src/cli.ts with minification and Bun bytecode into dist/beautiflow. The executable does not require Bun or node_modules at runtime; JSDOM is development-only, used by tests and the experimental AWS microsite builder, not by the executable.
Documentation site#
Markdown under docs/ is the canonical source. Build the static HTML documentation with:
bun run build:docs
The command writes clean-route pages, shared CSS, and copy-button JavaScript to dist/docs/, plus public protocol schemas to dist/schemas/. GitHub Pages runs the same generator against dist/site/docs; generated HTML and schemas are not committed. Internal Markdown links are rewritten to web routes, while every page links back to its source on GitHub.
For a visual release review, generate dist/diagram-contact-sheet.html:
bun run build:contact-sheet
The generator also fails when a committed SVG fixture lacks its accessible image contract. The contact sheet is review evidence, not a pixel-diff correctness gate.
Release gate#
bun run validate
This runs type checking, every Bun test, the standalone build, documentation generation, and the visual contact-sheet accessibility gate. CI additionally hides node_modules before exercising version output, agent inspection, and architecture rendering from the executable.
Test suites#
agent.test.ts— capability discovery, mutation boundaries, execution budgets, and doctor checksagent-runtime.test.ts— receipt states, stale evidence, correction budgets, rollback, schemas, and JSON failuresargs.test.ts— public command parsingdiagram.test.ts— layout, routing, actions, audits, and ELK edge associationdocs.test.ts— local links, public command coverage, agent protocol, release metadata, and site-version synchronizationexamples.test.ts— original Mermaid family compatibility suitediagram-types.test.ts— 23 additional diagram types, SVG/PNG, capability boundaries, and structured errorsarchitecture-agent.test.ts— geometry parity, integrity, diagnostics, safe edits, receipts, and rollbackaws-references.test.ts— published AWS reference reconstructions, topology/placement guards, native render fidelity and honest audit evidencepolish.test.ts— bounded candidate selection andFLOW.mdrender.test.ts— SVG, terminal, specialized families, and PNG signaturesserver.test.ts— save detection, last-good-render retention, and recoverysite.test.ts— developer site, Pages deployment, and verified installerdiagram-safety.test.ts— recorded source/receipt/hash fidelity, refusal boundaries, byte-exact rollback, static assembly and replay controlstransform.test.ts— source-preserving topology changes and semantic regression checks
Vendored Beautiful Mermaid files#
Bun’s compiled runtime is incompatible with the normal asynchronous ELK worker entrypoint used upstream. Beautiflow vendors the narrow synchronous Beautiful Mermaid layout/render adapter under src/vendor/beautiful-mermaid/ and retains its MIT license there.
When updating Beautiful Mermaid:
- Compare the vendored files against the new upstream implementation.
- Preserve the FakeWorker/synchronous ELK behavior required by compilation.
- Retain license and third-party notices.
- Run the example suite and visually inspect representative output.
Adding a diagram family#
Do not route a new family through flowchart semantics merely because it renders. Add explicit detection and a family-specific parser/renderer, using Beautiful Mermaid's specialized pipeline or the pinned Pele adapter. Mark whether the family is render-only or supports the complete project IR. architecture-beta uses Pele 1.13.0 with Iconify assets and concrete SVG colors. Keep Pele behind src/diagram/pele.ts; validate upgrades against the example suite before changing the exact pin. JSDOM is a development dependency for tests and prototype site generation, not part of the executable. The additive geometry module under src/vendor/pele-architecture/ is regenerated from the exact upstream source commit using scripts/vendor-pele-architecture.ts; see its README. Preserve upstream SVG bytes and keep audit limitations explicit. All-family detection must not accidentally grant flowchart mutations to a render-only type.
Adding a CLI option#
The product deliberately keeps its common path small. Prefer deterministic defaults and environment variables for automation-only behavior. Add a public flag only when users need a recurring decision that cannot be inferred safely.
Release artifacts#
PNG support includes native code. Build and test on each release target rather than assuming Bun cross-compilation carries the correct resvg binary. Publish checksums, a Sigstore checksum-manifest bundle, an SPDX SBOM, and third-party notices with binaries. The release workflow creates these artifacts automatically; macOS notarization remains a separate credentialed release requirement.