rustwasm/twiggy

Interactive REPL

Closed this issue ยท 3 comments

๐Ÿ’ก Feature Description

It would be nice if there was an interactive REPL that would allow you to quickly run a number of analyses on a program. Currently, the workflow for analyzing a wasm binary in depth is running a series of somewhat verbose commands, i.e. twiggy dominators -n [..] -d [..] /path/to/my/binary.

I'd love the ability to enter some sort of very basic REPL, potentially offering shorter aliases to commands, so that I can do something like:

This could potentially function as a stepping stone to #9?

๐Ÿ’ป Example Usage

Something like this would be great

$ twiggy --interactive /path/to/my/binary
> top -n 5
[Output here]
> dominators -d 2
[and so on]

The ability to load a different program without leaving the REPL might be a nice feature, as would writing the output of a command to a file with one of our CSV, JSON, etc. emission modes.

๐Ÿ™Œ Are you interested in implementing this feature?

Add an "X" to one of the following:

  • Yes
  • Yes if I had a mentor to help me
  • No

Other Notes:

A part of me is slightly concerned that this should be implemented in another crate altogether. I can already imagine that some of the tools in wabt would be great into incorporate into a REPL of this sort, which makes me wonder if this is out-of-scope for twiggy. On some level, I think there might be a very similar question when eventually tackling #9.

Feedback would be greatly appreciated, and this might be worth breaking apart into separate issues depending on what we believe makes sense. ๐Ÿ‘

I think maybe something like https://crates.io/crates/tui could also be good here, rather than a REPL, but I haven't considered the idea of a REPL enough yet.

The tui crate looks really useful! Maybe it would be possible to use some of those visualisations without jumping in a draw loop? I'll poke about and see what that could look like

As I'm doing a cleanup pass on the issues, I've added this: #581 for the tui-rs integration. We can add visualization functionality & other features once the building blocks are in place.