feat: implement console commands for accessing contract state data
Resolves #1722
Summary
Implements three new REPL commands for inspecting contract data during development:
::get_constant <contract> <constant>- Get constant value from a contract::get_data_var <contract> <var>- Get data variable value from a contract::get_map_val <contract> <map> <key>- Get map value from a contract
Implementation Details
- Added command handlers in
components/clarity-repl/src/repl/session.rs - Added help documentation for the new commands
- Added comprehensive tests in
components/clarinet-cli/tests/console.rs
Test Plan
- [x] All existing tests pass
- [x] Added unit tests for all three new commands
- [x] Commands work with both valid and invalid contract identifiers
- [x] Error handling works correctly for missing contracts/data
- [x] Help documentation displays properly
REPL demo of interaction with fixtures/mxs/counter.clar contract:
@hugoclrd please check, it's ready for review.
Hello @grandima Have you seen the review?
Thank you
@hugo-stacks thanks for such a quick and comprehensive review! I'm working on fixes. Meanwhile, I'll convert to draft and tag you when ready.
@hugo-stacks please check again as I applied the suggested changes and attached screenshots.
Codecov Report
:x: Patch coverage is 61.49068% with 62 lines in your changes missing coverage. Please review.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| components/clarity-repl/src/repl/session.rs | 61.49% | 62 Missing :warning: |
:loudspeaker: Thoughts on this report? Let us know!