feat(cli): add 'dimos graph' subcommand#2213
Conversation
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #2213 +/- ##
==========================================
- Coverage 70.09% 70.02% -0.08%
==========================================
Files 838 843 +5
Lines 74337 74801 +464
Branches 6667 6732 +65
==========================================
+ Hits 52110 52381 +271
- Misses 20552 20691 +139
- Partials 1675 1729 +54
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 5 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Non-root requests (e.g. /favicon.ico) now return 204 instead of terminating the single-request server with the HTML payload.
Route the diagnostic 'Found N blueprint(s)' message to stderr so piping '--markdown' output to a file doesn't get the message injected into the markdown stream.
Records the 5 greptile review comments on jeff/feat/dimos-graph: - 3283875847, 3283875929, 3284014771: already addressed in upstream commits 482d7ad, f87845e, ddb6856 - 3283876031: fixed in autofix commit f62f2f5 (_mermaid_id) - 3283875688: skipped (JS refactor in embedded template, exceeds easy threshold; symptom is mild)
6c2ea2c to
f87845e
Compare
|
we already have a very detailed renderer for dimos blueprints used in our documentation, as well as rerun blueprint graph view tab https://github.com/dimensionalOS/dimos/blob/main/docs/usage/modules.md is there a reason to introduce a new one? from dimos.core.introspection.svg import to_svg
from dimos.robot.unitree_webrtc.unitree_go2_blueprints import agentic
to_svg(agentic, "assets/go2_agentic.svg")I don't super mind this if someone prefers to above, but can add to core.introspection.mermaid perhaps |
…, leshy) Adds an entry for greptile P1 review #3286995045 (relative-imports fix above), records leshy's design question about merging this renderer with core.introspection.svg as a discussion-only entry, and standardizes the existing _mermaid_id entry on a full 40-char commit SHA.
Record pr_responses.yaml entry for mustafab0's 2026-05-23 review comment on PR #2213 (#3292493576) suggesting the 242-line embedded HTML f-string in _build_html become a separate graph.html file. Marked skipped — the choice of templating mechanism (str.format vs string.Template vs marker .replace vs Jinja2) is an architectural call that needs Jeff's input, and there are no unit tests covering _build_html so a silent rendering regression would not be caught by CI.
…s into jeff/feat/dimos-graph
Stream names with characters like [ ] ( ) . would produce invalid Mermaid syntax and break diagram rendering.
Yeah I know. For context, I never planned to PR this, I've been using it since February - Mustafa and Andrew just saw me using it and asked if I could add it to dimos. I don't find the existing tools useful for debugging blueprint streams, so I end up using this a lot. Main differences:
|
…nt.mermaid Move render_mermaid, themes, and color logic out of the CLI module into a reusable location. Add ocean/ember/forest/light themes with per-theme background colors, wire --theme through the CLI, and fix stream resolution for files using `from __future__ import annotations`.
…ering Snapshot test builds HTML from a complex blueprint with dangling streams, serves it over HTTP, and compares to a cached file. Snapshot auto-updates on mismatch so the next run passes.
| producers: dict[str, list[str]] = {} | ||
| for atom in bp.blueprints: | ||
| for stream in atom.streams: | ||
| if stream.direction == "out": | ||
| topic = f"{stream.name}:{stream.type.__name__}" | ||
| producers.setdefault(topic, []).append(atom.module.__name__) |
There was a problem hiding this comment.
Conflict detection ignores
remapping_map, diverging from the rendered graph
render_mermaid applies blueprint_set.remapping_map.get((atom.module, stream.name), stream.name) before computing stream keys, so the graph shows remapped names. This conflict-detection block uses the raw stream.name, so when any remapping is in use, the "stream fighting" warning operates on a different view of the blueprint than what is drawn. A producer whose stream is remapped to name X will appear under its original name here but under X in the graph — causing false-positive conflicts (two modules mapped to the same raw name that differ after remapping) and false-negatives (two modules both mapping to the same final name that started with different raw names).
| producers: dict[str, list[str]] = {} | |
| for atom in bp.blueprints: | |
| for stream in atom.streams: | |
| if stream.direction == "out": | |
| topic = f"{stream.name}:{stream.type.__name__}" | |
| producers.setdefault(topic, []).append(atom.module.__name__) | |
| producers: dict[str, list[str]] = {} | |
| for atom in bp.blueprints: | |
| for stream in atom.streams: | |
| if stream.direction == "out": | |
| remapped = bp.remapping_map.get((atom.module, stream.name), stream.name) | |
| if not isinstance(remapped, str): | |
| continue | |
| topic = f"{remapped}:{stream.type.__name__}" | |
| producers.setdefault(topic, []).append(atom.module.__name__) |
Adds
dimos graph <python_file>to render Blueprint flowchart diagrams as interactive Mermaid in the browser, designed for debugging.Example
Options
--no-disconnected— hide disconnected streams--markdown— print Mermaid markdown to stdout instead of serving--port— pick HTTP port (default: random)