feat(exec): add streaming, pagination, and serialization for query execution#360
Open
joewiz wants to merge 5 commits intoeXist-db:mainfrom
Open
feat(exec): add streaming, pagination, and serialization for query execution#360joewiz wants to merge 5 commits intoeXist-db:mainfrom
joewiz wants to merge 5 commits intoeXist-db:mainfrom
Conversation
Add streaming query execution via WebSocket to the existing exec command. --stream connects to the /exist/ws/eval endpoint and prints results as they arrive, with Ctrl+C cancellation support. --timing reports execution timing in both HTTP and streaming modes. Depends on the server-side WebSocket eval endpoint (eXist-db/exist#6145). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests argument parsing for new flags, WebSocket URL construction, auth header encoding, and --timing integration over HTTP. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
59bdf2d to
c574b1b
Compare
Use lsp:eval/lsp:fetch via REST API for paginated query results as the default execution mode (falls back to XML-RPC if unavailable). Interactive TTY sessions show a page prompt; piped output fetches all pages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verifies that piped (non-TTY) output fetches all pages without showing interactive pagination prompts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pass serialization options to lsp:fetch (cursor mode) and to the WebSocket eval message (streaming mode). Supports xml, json, text, html, and adaptive methods; indent yes/no; and full-text highlight. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Overhauls the
execcommand with three new execution capabilities and rich serialization control.Execution modes
lsp:eval/lsp:fetchvia REST API; interactive TTY sessions prompt between pages, piped output fetches all pages automatically. Falls back to XML-RPC if thelspmodule is unavailable.--stream) — connects to/exist/ws/eval, prints results as they arrive, Ctrl+C sends cancel.--bindvariables are provided or cursor API is unavailable.New flags
--stream/-s--timing/-t--page-size <n>--output/-otext(default) orjson--methodxml,json,text,html,adaptive--indent/--no-indent--highlightSample commands
Dependencies
Requires the server-side WebSocket eval endpoint from eXist-db/exist#6145 for
--streamto function. Cursor-based pagination requires thelspXQuery module; falls back to XML-RPC automatically if unavailable.--timingwithout--streamworks against any existing eXist-db instance.Test plan
xst exec "1+1"— uses cursor API, falls back to XML-RPCxst exec --timing "1+1"— prints result + timing to stderrxst exec --stream "for $i in 1 to 10 return $i"— streams items via WebSocketxst exec --stream --timing "1+1"— streams + shows granular timingxst exec --page-size 50 "for $i in 1 to 1000 return $i"— paginated output with custom page sizexst exec --output json "map { 'key': 'value' }"— JSON-formatted outputxst exec --method text 'string-join(("a","b","c"), ",")'— text serializationxst exec --no-indent "<root><child/></root>"— suppressed indentationxst exec -b '{"a":1}' '$a+$a'— variable bindings use XML-RPC path--stream— sends cancel, prints summaryxst exec --page-size 5 "..." | cat) fetches all pages without prompting🤖 Generated with Claude Code