mix foundry.diagram.generate (foundry v0.1.3)

Copy Markdown

Builds the system map graph by calling Foundry.Context.Introspector.build_all/1, projecting the result into Foundry.Diagram.SystemMap (nodes, edges, clusters), and writing the output to docs/diagrams/system_map.json.

The committed JSON file is the source of truth for the Phase 2 D3 renderer. INV-008 requires that the diagram is always current — CI runs this task with --check and fails if the output would differ from the committed file.

Usage

mix foundry.diagram.generate            # regenerate and write to disk
mix foundry.diagram.generate --json     # emit JSON to stdout, no disk write
mix foundry.diagram.generate --check    # exit 1 if output differs from committed

Output file

docs/diagrams/system_map.json relative to the project root. The directory is created if it does not exist.

Check mode (CI)

In check mode, the task generates the graph, compares it to the committed file, and exits 1 if they differ. The comparison ignores the generated_at timestamp field — only structural changes (nodes, edges, clusters) are considered meaningful differences.

Graph construction

Nodes    one per module in context.all output
Edges    derived from:
            - Ash relationships (belongs_to, has_many, has_one, many_to_many)
            - Transfer rules: Transfer  Rule (applies_rule edge)
            - Transfer steps that reference resources (transfer_step edge)
Clusters  one per domain name (grouping the domain's nodes)

test_coverage derivation

Node.test_coverage is derived from ModuleContext.test_coverage: :none — all three coverage booleans false :partial — at least one true, not all :full — all three true