Skip to content

archspec_diagram

archspec_diagramv0.1.0MIT

Draw an Archspec.rb as a Mermaid flowchart

Install

gem install archspec_diagram

archspec_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.

  • Three formats. -f mermaid is the bare diagram, -f markdown adds a heading and a legend table, and -f html writes a standalone page.
  • Detail levels. --detail names draws components and arrows, rules (the default) adds selectors and rule lines, and reasons adds every because: text.
  • One component. --focus billing keeps one component, every component it links to or from, and the project-wide rules.
  • A safe output file. -o writes to a temporary file and renames it, so a failed run leaves the previous diagram in place.

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.

archspec_diagram needs Ruby 3.2 or later and archspec 1.1.x.

Terminal window
gem install archspec_diagram
archspec_diagram
archspec_diagram -f markdown -o ARCHITECTURE.md