Feature Request: Visual Grouping of Submodules by Parent Module (--groups command)
Description
Currently, modules are displayed individually, without any visual indication of their logical grouping. This makes it difficult to quickly understand the high-level structure of the project, especially when dealing with common architectural layers such as application or infrastructure.
Feature Proposal
Introduce a new command-line option:
crago modules --groups <NAMES>
This option would allow users to specify high-level parent module names (e.g., application, infrastructure) and have all submodules under those namespaces visually grouped together in the output.
For example:
crago modules --groups application,infrastructure
This would visually group all modules under the application and infrastructure trees accordingly, helping users identify which modules belong to which major architectural layers.
Benefits
- Improves readability and navigability of module structures
- Highlights architectural boundaries and responsibilities
- Makes large codebases more approachable for new developers
- Useful for presentations, documentation, or architecture reviews
If it fits into the idea of developing the system, I could implement this functionality if it appears in the next release. I am extremely interested in it and would not like to write an intermediate solution in the form of a parser of the output dot file.
Hi, @regexident ! 👋
Since there was no response to the feature request above, I went ahead and built a separate CLI tool in Python to support this functionality.
It works as a post-processing step: You can pipe the output of cargo modules into my tool to produce a visually grouped version of the module diagram, like this:
cargo modules | python3 -m dot_analyzer.cli transform modules.dot -o updated.dot
This allows grouping by high-level module prefixes (e.g., application::, infrastructure::) to make the architecture easier to understand and present.
If there's still interest in integrating something like this natively, I'm happy to help or discuss it further. Otherwise, I’ll continue maintaining the external tool for now.
Thanks again for the great work on this project!
Hi, @regexident ! 👋
Hi @J4CKVVH173! 👋
Since there was no response to the feature request above, I went ahead and built a separate CLI tool in Python to support this functionality.
I'm so sorry for never getting back to you on this issue! 😔
It works as a post-processing step: You can pipe the output of cargo modules into my tool to produce a visually grouped version of the module diagram, like this:
cargo modules | python3 -m dot_analyzer.cli transform modules.dot -o updated.dot This allows grouping by high-level module prefixes (e.g., application::, infrastructure::) to make the architecture easier to understand and present.
It looks great!
If there's still interest in integrating something like this natively, I'm happy to help or discuss it further. Otherwise, I’ll continue maintaining the external tool for now.
I currently don't have much bandwidth for adding features to cargo-modules, let alone non-trivial ones, but I would be more than happy to help upstream the feature as much as I can.
Thanks again for the great work on this project!
Glad people find the tool useful! ❤
I see, thank you for your reply.
I'll be looking forward to it.