I'd like to use statecharts with bb to define devops workflows. Sometimes I find charts get a little bit hard to understand by just reading the source. What's the cheapest way to get some viz for this kind of thing?
I tried to give Claude the statecharts visualizer repo and my toggle chart above and have it using the POST route. Didn't give it much guidance beyond that. It wasn't able to pull it off. I haven't had time to dig in.
@naomarik768 here's a small demo
Have you got statecharts working in BB?
Yes
I hadn’t tried
The easiest thing to do is ask AI to make a fulcro webapp that uses the existing visualization, where bb can POST it as application/edn (with lambdas stripped). The it would serve the UI on line port 8091 and you can view them in a browser…get a bit more fancy and post “current configuration” for a chart and you can have live updates…e.g. “instrument” your BB event queue to send updates to the chart viz server 😄
Ty I'll have a shot at that. I think the only gotcha was using the promesa version which adds bb support. The sc releases include a promesa version that doesn't have bb support.
ah..ok, so you have to override.
Yep
@alex.sheluchin can you gimme a minimum working example? i love this idea for bb + statecharts for certain tasks.
what's much harder is figuring out what a bunch of bashscripts are trying to do and figuring out whether they get you into the state you'd want
I’m pushing a branch on the statecharts lib, and also a new repo with visualization tools…nothing finalized yet, but might be useful (the standalone app is intended to open a POST REST API where you could send your chart, or you could co-locate your chart in source and it can do namespace scanning…mostly AI-written and not reviewed yet, but might be useful, or perhaps you can contribute.
The viz2 branch on the statecharts repository (some viz improvements, which I’ve pushed as 1.4.0-RC3-SNAPSHOT)
https://github.com/fulcrologic/statecharts-visualizer is the standalone visualizer…untested (ai written) but should be close…I’ll try it out as I have time, but you’re welcome to give it a shot. The README won’t work yet as I have not pushed it to clojars…you’ll have to use :local/root instead
Just glancing at it, it looks like it is assuming that the statecharts resources is going to be on the classpath, which isn’t true…so it’s got an issue or two
I’m having AI fix that now…
I've got a killer headache but I'll post a minimal implementation tomorrow. Looking forward to following up on the ideas posted here as well as your viz2 impl. While we're at it, another useful angle might be to see about getting sc working in sci because that might open up a totally different lightweight pathway for viz.
This is working now:
clojure -Sdeps '{:deps {com.fulcrologic/statecharts-visualizer {:mvn/version "1.0.0-SNAPSHOT"}}}' -M -m com.fulcrologic.statecharts.visualizer.standalone
and I had it do the namespace scanning for demos included with the project and that worked…so if you add it as “extra deps” to an existing project, it should be able to find the charts
If you do it like this (say in the statecharts project where the routing-demo2 has a CLJC chart):
clojure -Sdeps '{:aliases {:viz {:extra-deps {com.fulcrologic/statecharts-visualizer {:mvn/version "1.0.0-SNAPSHOT"}}}}}' -A:viz:dev:cljs:test -M -m com.fulcrologic.statecharts.visualizer.standalone
• Click Simulation in the UI
• Scan namespaces should activate
• Type in com.fulcrologic.statecharts.routing-demo2.chart and it should find a chart
• Select it in the dropdownscanning only works on CLJ/CLJC files, of course.
needs some polish, but better than nothing for sure.
There’s already viz
It’s CLJS ELK-based stuff…right now the rendering is wrapped in Fulcro components…I have exported it into Fulcro Inspect when using that integration, but there’s also CLJ-based code that makes a server that can serve any CLJC chart to the UI as a visualization…the ELK library isn’t in bb, though. There is a JVM and JS version of ELK, I just didn’t write any adapter yet.
I managed to get a simple terminal rendering with bb and https://github.com/AlexanderGrooff/mermaid-ascii but mermaid doesn't actually have great sc support and my current implementation won't scale well to more complex charts.