Skip to content

feat(plugins): add JSON Workbench RPC example - #381

Merged
fcoury-oai merged 36 commits into
mainfrom
fcoury/json-workbench
Oct 14, 2026
Merged

fcoury-oai merged 36 commits into
mainfrom
fcoury/json-workbench

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

This adds a realistic, distributable JSON-RPC plugin that exercises the host contract introduced by #380. The existing hello example proves transport and command dispatch, but it does not expose the document identity, responsiveness, presentation, persistence, and action-discovery requirements that appear in an interactive editor workflow.

JSON Workbench is a standalone Python plugin that runs jq against a pinned source document. It provides editable query documents, live previews with cancellation, selection-scoped queries, a native result explorer, saved query history, exact raw-result copying, frozen result documents, and revision-checked apply/undo. Its panel keeps the primary Run, Apply, and Close actions visible while F1 and panel-local keys expose the full action set.

The supporting pending 0.19.0 RPC contract gains the surfaces this workflow requires: stable document targeting, document creation/show/watch, selection snapshots, inactive document transactions, text-panel code blocks and actions, clipboard writes, foreground messages, and owner-scoped cleanup. Husk and JSON-RPC plugins continue to coexist, with resources isolated per owner and existing Husk command precedence preserved.

This PR depends on #380. Until that foundation merges, GitHub will include its commits in this PR's diff.

How to Test

  1. Build Red, install examples/rpc-json-workbench with red plugin install --path ./examples/rpc-json-workbench, and open a JSON file containing {"users":[{"name":"Ada","active":true},{"name":"Lin","active":false}]}.
  2. Run :JsonQuery .users | map(select(.active)). Expect a syntax-highlighted JSON panel containing only Ada and a durable JSON: ready status.
  3. Focus the panel with Ctrl-w l, press c, and confirm ✓ JSON result copied appears transiently while the ready status remains. Press F1 and confirm the complete action list is discoverable.
  4. Run :JsonWorkbench, edit the ordinary query document, enable :JsonLive, and edit the source. Expect the preview to coalesce changes without blocking editor input; verify Cancel remains responsive.
  5. Exercise Explore, Open Result, Apply, and Undo. Expect exploration to preserve the exact raw result, result documents to outlive plugin UI, and stale source revisions to reject Apply safely.
  6. Run python3 tests/test_json_workbench.py, cargo test --test rpc_connection --all-features, and cargo clippy --all-targets --all-features -- -D warnings.

@fcoury-oai
fcoury-oai merged commit afea447 into main Oct 14, 2026
28 of 30 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/json-workbench branch October 14, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant