Meduza: Zig codebase graph generator

Hi, everyone!
I’ve been playing a bit with the idea of generating lean visualizations of Zig codebases as graphs, which are usually called class diagrams. Here’s the progress so far:

I’d love to hear any thoughts or feedback you might have! Also feel free to ask questions or open issues/discussions on GitHub.


Great stuff - I’m just annotating as I read along here…

I personally like your coding hints you’ve put in place. Maybe give an option in the future for users to turn those off? I can imagine someone wanting to just read about an existing codebase, and if you had someone who formatted a lot of functions in this way, you’d probably get a ton of style-guidance mixed in with the readout.

try stdout_writer.print("  - Consider making a single line or referencing a type definition instead: {s}/{s}#L{d}\"\n", .{ remote_src_dir_path, entry.path, line_num });

Maybe consider giving these equality constants a name? The long whitespace checks are a little unclear as to what you’re looking for:

if (std.mem.eql(u8, "     ", src[first_token_start - 5 .. first_token_start])) {
    if (std.mem.eql(u8, "         ", src[first_token_start - 9 .. first_token_start])) {

Anyhow, really neat utility. Good use of standard library features. It’s extremely dense code because you’re basically running through the entire parse in one go but… I’m sure you know that :slight_smile:


Thanks so much for taking the time to review!

Following your advice, I’ve documented and deduplicated as much code as I could. Readability is certainly boosted now!

I’ve also swapped out stdout writer with info-level log. But I should probably still make it a build option, like you suggested.


Great idea and execution! Thanks for sharing


Good morning,
Why didn’t you get the clapperboard pieces to integrate it into your project, it’s ugly, the call to the archive.
You can very well mention that you are inspired by clap with a reference link

Your project is great too, I was looking for something like that. CHEER