gabotechs / dep-tree

Tool for helping developers keep their code bases clean and decoupled. It allows visualising a code base complexity using a 3d force-directed graph of files and the dependencies between them.
https://github.com/gabotechs/dep-tree
MIT License
1.4k stars 35 forks source link

Could `dep-tree entropy` take a graph (as JSON?) as input? #84

Closed ramirez7 closed 2 weeks ago

ramirez7 commented 4 months ago

Hello,

My coworker and I have been working on a project with similar goals & philosophy as dep-tree: https://github.com/dustin/graphex

It analyzes Haskell codebases and produces the graph as JSON. And it provides a CLI to analyze deps (for instance, you can ask why one file depends on another file to debug a tangled graph).

It already supports Looking Glass for visualization, but dep-tree entropy looks like it would be an improvement in many ways.

I'd love to hook it up to dep-tree entropy. But it looks like dep-tree entropy doesn't support just giving it a graph in some standard format? And it instead couples the graph generation with the graph visualization?

If there was some JSON format I could target, I could easily write a graphex graph dep-tree that converts graphex's JSON format to dep-tree's.

(I'd happily do the legwork to make this happen myself btw! If you have any pointers for getting started.)

ramirez7 commented 4 months ago

Oh wait I found this https://github.com/gabotechs/dep-tree/issues/76

Is the format documented somewhere? Also, I don't think entropy supports it afaict.

gabotechs commented 4 months ago

But I don't think you can use that, that's an output format for dumping the created graph in a json file. If I understand correctly what you want is a way to provide the already formed graph to dep-tree entropy so that it can render it.

Right now providing an input in a standard format is not supported, the best way to achieve this would be to create a language implementation that instead of referring to an actual programming language, it would accept a json file.

I wrote a guide about how to contribute new language implementations https://github.com/gabotechs/dep-tree/blob/main/docs/IMPLEMENTING_NEW_LANGUAGES.md. Your use-case is not strictly a programming language, but the idea is pretty much the same: receive a file as an input and parse its contents in order to form the graph.

Feel free to take a look and see if that could work for you!

ramirez7 commented 4 months ago

Sweet! Thanks for the pointers. I'll cut a PR when I get the chance :grin: