Fix bin/gen_diagrams that is referenced in docs#1291
Conversation
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…s into jeff/fix/gen-diagrams
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Greptile SummaryThis PR adds the missing
Confidence Score: 4/5
Important Files Changed
Flowchartflowchart TD
A["bin/gen-diagrams invoked"] --> B{"Arguments provided?"}
B -- Yes --> C["Iterate over provided files"]
B -- No --> D["find ./docs -name '*.md'"]
D --> E["Iterate over found files"]
C --> F{"md-babel-py installed?"}
E --> F
F -- Yes --> G["Run md-babel-py run FILE --lang langs"]
F -- No --> H{"nix installed?"}
H -- Yes --> I["Define md-babel-py wrapper via nix run"]
I --> G
H -- No --> J["Error: install nix or md-babel-py"]
Last reviewed commit: 1056faa |
| 1. Where to put your docs: | ||
| - If it only matters to people who contribute to dimos (like this doc), put them in `docs/development` | ||
| - Otherwise put them in `docs/usage` | ||
| 2. Run `bin/gen_diagrams` to generate the svg's for your diagrams. We use [pikchr](https://pikchr.org/home/doc/trunk/doc/userman.md) as a diagram language. |
There was a problem hiding this comment.
All this does is executes md-babel-py run - this is just another adapter layer to maintain and should be a personal shell alias not a /bin/ script imo.
if others need this, that's ok and can add it - but expectation is for scripts in /bin/ to always work and be up to date
There was a problem hiding this comment.
~30 lines is not an alias; even ignoring the installation help/check, at the bottom there's a for loop for iterating over all the file paths -- a for loop doesn't fit in an alias. I have lots of my own aliases for things that are just-for-me. This was designed specifically to help others.
Idk why but md-babel-py seems to only be able to handle one file path at a time, using shell globbing doesn't work. If you add support for that it would make this wrapper less necessary.
expectation is for scripts in /bin/ to always work
Yes? This function should always work. If contributors are not able to generate diagrams for docs in one line thats a problem IMO. Why would we make each person on the team copy this wrapper and define it in their own shell?
If we add a new diagram lang we can just change this function instead of telling everyone else to change their alias's.
There was a problem hiding this comment.
If anything IMO it would be nice to add a --watch flag to this script so that real-time editing of diagrams can be rendered locally instead of needing to run the command every time.
Also I made a PR on md-babel-py to make it work with Nix on MacOS whenever you get the chance to merge it:
leshy/md-babel-py#1
There was a problem hiding this comment.
ok I merged your md-babel PR, and published to pypy (v1.1.2) tnx for mac support!
I actually didn't write a single diagram by hand yet (have you?) agents have been drawing those for me, in docs instructions they know how to regenerate, this is why I didn't work on ergonomics of this.
but all above is good and reasonable imo, I'd prefer to add these things to md-babel-py directly, both --watch and --recursive, instead of adding an adapter layer like this. md-babel-py is a mostly quickly vibed project for me to write the docs, so I'd just vibe those commands as well.
As for re-generating diagrams, I'd add an option (temporarily) directly to md-babel-py - --diagrams but actually much better, I wouldn't differentiate code blocks vs diagram blocks and I'd add some caching mechanism (hash in code block args after language) for unchanged code blocks to not be re-evaluated.
I still think above adds a random layer that should be in md-babel-py but won't block since not very important, I let you decide
Closes DIM-553