[Proposal] Unify underlying CLI capabilities
💥 Proposal
There should be a unified crate or utility where the snarkOS, leo, and sdk CLIs can pull shared functionality from.
For example, both snarkOS and leo CLIs have the following capabilities:
- account creation
- execute
- deploy
They are all different in implementation and are maintained separately. In addition, it would be nice for snarkOS to have the leo query capabilities as well, but it should not need to fetch it from leo.
Unifying all these impls will reduce code duplication and make maintaining the codebases easier. An example could be updating Query in snarkVM to support these and propagated up to leo and snarkOS.
@d0cd @kaimast ^From our CLI discussions in https://github.com/ProvableHQ/snarkOS/pull/3759#discussion_r2289244686
In #3789 I am also adding serialization of anyhow::Error to the API (see here). A unified crate should include this functionality as well. It could rely on functionality introduced in snarkVM PR #2813.
We also need to set up a process to keep the endpoints, client library, and API documentation in sync. There are some crates that allow generating an OpenAPI spec from axum code, e.g., utopia. In theory, this would be great as it can automatically create documentation and Rust client code for the endpoints, but it might not work for our specific case.
I'll note that we should have a small design document or more specific scoped specification in this issue for this before we move forward with any implementation (as we should have had for compact blocks and other features too ;) )