Expand description
Generate Mermaid architecture diagrams from Cap’n Proto schema metadata and auto-detected service dependencies.
Usage: cargo run –bin generate-rpc-diagrams – [–metadata-dir PATH] [–services-dir PATH] [-o PATH]
Reads:
- *_metadata.json files (from capnp build output) for method counts + scopes
- services/factories.rs for service registrations, transport types, QUIC support
- services/*.rs for client imports (auto-detected call graph)
Structs§
- DepEdge 🔒
- Method
Call 🔒 - A detected method-level call from one caller to a target service method.
- Method
Def 🔒 - A method defined in a service’s schema.
- Service
Meta 🔒
Enums§
Constants§
- CLIENT_
TYPES 🔒 - All known client/type names to scan for.
Functions§
- build_
method_ 🔒registry - Parse all metadata files to build a method registry.
- caller_
id 🔒 - Generate a stable node ID from a caller string.
- client_
to_ 🔒service - Maps a client/type name found in source to the service it connects to.
- extract_
quoted 🔒 - Extract the first quoted string from a line.
- filename_
to_ 🔒service - Maps a source filename to the service it implements.
- find_
client_ 🔒deps - Find client type references in a source file.
- generate_
call_ 🔒graph - Generate the method-level call graph diagram.
- generate_
method_ 🔒breakdown - generate_
summary_ 🔒table - generate_
topology 🔒 - has_
client_ 🔒prefix - Check if a line has a known client variable prefix before the method call. Matches patterns like: policy_client.check(, model_client.load(, registry.list(
- main 🔒
- parse_
metadata 🔒 - path_
to_ 🔒caller - Map a relative source path to a caller identity.
- resolve_
call_ 🔒target - Resolve which service a method call targets based on context.
- scan_
factories 🔒 - Parse factories.rs to extract service registrations with transport + QUIC.
- scan_
factory_ 🔒body - Scan a factory function body to detect transport type and QUIC support.
- scan_
factory_ 🔒dependencies - Scan factories.rs to detect which clients each factory function creates.
- scan_
method_ 🔒calls - Scan all Rust source files for method-level calls to known service methods.
- scan_
service_ 🔒sources - Scan services/*.rs files for client type usage to build call graph.
- scope_
name 🔒 - service_
label 🔒 - title_
case 🔒 - to_
snake_ 🔒case - camelCase → snake_case conversion (e.g., “generateStream” → “generate_stream”)
- walk_
rs_ 🔒files - Recursively walk .rs files.