archspec_diagram
archspec_diagramv0.1.0MIT
Draw an Archspec.rb as a Mermaid flowchart
Install
gem install archspec_diagramarchspec_diagram draws an Archspec Archspec.rb as a Mermaid flowchart.
Components become boxes, allowed and forbidden dependencies become arrows, and the other rules become text inside the boxes.
It reads the config the way archspec check does but never analyzes the code, so it needs no Rails boot.
Features
Section titled “Features”- Three formats.
-f mermaidis the bare diagram,-f markdownadds a heading and a legend table, and-f htmlwrites a standalone page. - Detail levels.
--detail namesdraws components and arrows,rules(the default) adds selectors and rule lines, andreasonsadds everybecause:text. - One component.
--focus billingkeeps one component, every component it links to or from, and the project-wide rules. - A safe output file.
-owrites to a temporary file and renames it, so a failed run leaves the previous diagram in place.
How an agent uses it
Section titled “How an agent uses it”The command prints an error as one line on stderr, never a backtrace.
It exits 0 on success, 1 for a config or I/O problem, and 2 for a usage error.
Rendering is deterministic, so a test such as assert_equal File.read("docs/architecture.mmd"), ArchspecDiagram.render("Archspec.rb") fails when a committed diagram is stale.
Getting started
Section titled “Getting started”archspec_diagram needs Ruby 3.2 or later and archspec 1.1.x.
gem install archspec_diagramarchspec_diagramarchspec_diagram -f markdown -o ARCHITECTURE.md