Skip to content

feat(contribs): add gnopie - httpie-inspired CLI for gno.land#5444

Draft
moul wants to merge 24 commits intomasterfrom
gnokey-opinionated
Draft

feat(contribs): add gnopie - httpie-inspired CLI for gno.land#5444
moul wants to merge 24 commits intomasterfrom
gnokey-opinionated

Conversation

@moul
Copy link
Copy Markdown
Member

@moul moul commented Apr 7, 2026

gnopie — like httpie, but for gno.land

gnopie gno.land/r/gnoland/blog                          # Browse a realm (Render)
gnopie 'gno.land/r/gnoland/blog.Render("")'             # Evaluate a function
gnopie gno.land                                          # Network info
gnopie g1manfred47kzduec920z88wfr64ylksmdcedlf5         # Inspect address
gnopie https://gno.land/r/gnoland/blog:p/beta-mainnet   # Paste gnoweb URL
gnopie INSPECT gno.land/r/gov/dao                        # List files + functions
gnopie READ gno.land/r/gnoland/blog.ModAddPost           # Function source code
gnopie READ gno.land/r/gnoland/blog/admin.gno            # Read a specific file
gnopie CALL 'gno.land/r/demo/wugnot.Deposit()'          # Sign & broadcast tx
gnopie RUN 'gno.land/r/demo/counter.Increment()'        # Execute via maketx run
gnopie CALL --print-gnokey-command 'gno.land/r/demo/wugnot.Deposit()'
gnopie --json gno.land/r/gnoland/blog | jq .result       # JSON for piping
gnopie --debug gno.land/r/gnoland/blog                   # Show internals

What

An opinionated CLI that wraps gnokey as a Go library with an httpie-inspired verb-based API.

Verb Description
GET (default) Render for realms, EVAL for calls, READ for symbols
EVAL Evaluate a read-only function call
READ Read source code, file, or variable value
INSPECT Inspect network, realm, or symbol in detail
CALL Sign and broadcast a MsgCall transaction
RUN Generate code and broadcast a MsgRun transaction

How

  • Auto-discovery: Fetches <meta name="gnoconnect:rpc"> from domain — no config needed
  • Auto-gas: Simulate → estimate → broadcast with 50% buffer
  • Crossing functions: cross auto-injected for realm functions
  • Caching: Discovery (24h) + query results (1h) cached locally
  • gnoweb URLs: Paste any gnoweb URL directly (https://, :renderpath, $source, $help)
  • gnopie config set key=moul: Persist default signing key

Tests

61 tests total:

  • 28 table-driven CLI tests x2 passes (fresh + cached) against in-memory node
  • 5 stateful tests (CALL/RUN increment counter, verify state)
  • Pattern follows gnovm/cmd/gno/run_test.go style

Test plan

  • make install builds
  • make test — 61 tests pass
  • All verbs tested: GET, EVAL, READ, INSPECT, CALL, RUN
  • gnoweb URL stripping, fragments, render paths
  • JSON output, debug output, --print-gnokey-command
  • Error cases: empty args, missing expression, non-existent symbols
  • Cache behavior verified across fresh/cached passes

AI-assisted PR (Claude Code).

moul added 2 commits April 7, 2026 12:50
gnosh wraps gnokey as a Go library to provide a better day-to-day CLI
experience for interacting with gno.land chains.

Initial commands:
- call: execute realm functions with auto-gas estimation
- query: read-only qeval/render queries
- version: print version info

Features: --dry-run, --generate-gnokey, --json output, auto-gas.
@Gno2D2
Copy link
Copy Markdown
Collaborator

Gno2D2 commented Apr 7, 2026

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

No automated checks match this pull request.

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

gnopie provides an opinionated, httpie-style interface for gno.land chains.
Replaces the earlier gnosh prototype with a cleaner verb-based API.

Verbs: GET (default, smart dispatch), EVAL, READ, INSPECT, CALL, RUN.
Features: domain-based remotes, auto-gas, --dry-run, --generate-gnokey,
--json output, shell completion (bash/zsh/fish).
@moul moul changed the title feat(contribs): add gnosh — opinionated gno shell CLI feat(contribs): add gnopie — httpie-inspired CLI for gno.land Apr 7, 2026
moul added 5 commits April 7, 2026 13:38
Replace hardcoded remotes with gnoconnect discovery: gnopie fetches the
domain's gnoweb homepage and reads <meta name="gnoconnect:*"> tags to
find RPC endpoint and chain ID. Results are cached locally for 24h.

This removes the remotes subcommand entirely — no manual config needed.
@moul moul changed the title feat(contribs): add gnopie — httpie-inspired CLI for gno.land feat(contribs): add gnopie - httpie-inspired CLI for gno.land Apr 7, 2026
moul added 6 commits April 7, 2026 14:40
15 tests covering all verbs against a real in-memory gno node:
- GET (Render, render path, gnoweb URLs with fragments)
- EVAL (function call, crossing function auto-inject)
- READ (function source, file)
- INSPECT (realm, network)
- CALL (increment counter, verify state, generate-gnokey)
- RUN (increment counter via maketx run, crossing auto-inject)
- JSON output, address inspection

Also fixes RUN to auto-inject `cross` for crossing functions in
generated code.
28 table-driven test cases run twice (fresh + cached) against an
in-memory node, plus 5 stateful tests for CALL/RUN mutations.

Tests cover: GET (render, gnoweb URLs, address), EVAL, READ (source,
file), INSPECT, JSON output, debug output, --print-gnokey-command,
error cases. Stateful tests verify counter increment via CALL and RUN.
…password

- INSPECT now shows Functions + Variables + Constants by default
- Files only shown with --all flag
- --dry-run no longer prompts for password (shows what would be sent)
- Fix test names: default verb tests don't say "GET"
- Gas estimation buffer reduced from 50% to 20% (configurable)
- gnopie config set gas-buffer=30 to change
- Fix lint: remove unused functions, use tagged switch
- Clarify query cache: only source code and function signatures cached
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤝 contribs 🐹 golang Pull requests that update Go code

Projects

Status: No status
Status: 📥 Inbox

Development

Successfully merging this pull request may close these issues.

2 participants