Hey guys,
I often find myself creating presentations to explain codebases at various levels of abstraction. Since these presentations often follow similar patterns and can be time-consuming to make, I’m looking to automate the process.
Inspired by how DocC leverages the AST to generate structured documentation, I’m experimenting with a similar approach to produce abstracted block diagrams. The idea is to visualize only the "important parts" of a system—e.g., key workflows, modules, or function call paths.
Right now, I have a function that parses Swift source files and comments, extracts a rough overview, and sends that to a local LLM. The model outputs a JSON structure that I then render into a PDF using SwiftUI. This is a good start, but it still feels shallow. For a more robust and versatile implementation, I’d need to work with the AST directly—but writing a full AST parser isn't something I want to dive into right now.
So here’s my question:
How can I enrich my code with metadata or hints—used solely for tooling or visualization—without actually affecting the runtime codebase?
I’ve thought about using macros that inject data into a singleton or registry, but that introduces real code, which I’d like to avoid. Ideally, I’m looking for something akin to annotations or doc-comments that tooling can pick up on but the compiler ignores entirely.
Any ideas, approaches, or scripts you’ve used for something like this?
Thanks in advance!