feat(cli): add query dry-run mode#938
Open
Arvind-puthucode wants to merge 1 commit into
Open
Conversation
Member
|
I like this! |
xav-db
approved these changes
Jun 15, 2026
Author
|
Hey @xav-db nice to know |
Member
|
can you fix conflicts |
b1f99e4 to
c00b944
Compare
Author
@xav-db done |
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.
Description
Adds a
--dry-runoption tohelix queryso users can inspect the generated dynamic query request JSON without sending it to a Helix instance.This works with all existing query inputs (
--file,--json,-e/--ts, and--ts-file) and respects--compactfor single-line output. Dry-run mode validates the request shape, prints the request body, and exits before loading project config or making an HTTP request.Related Issues
N/A
Checklist when merging to main
rustfmthelix-cli/Cargo.tomlandhelixdb/Cargo.toml(N/A - CLI behavior only)Additional Notes
Verification run locally:
cargo fmt --allcargo test -p helix-cliHELIX_NO_UPDATE_CHECK=1 cargo run -p helix-cli --quiet -- query dev --json '{"request_type":"read","query":{"queries":[]}}' --dry-run --compactGreptile Summary
This PR adds a
--dry-runflag tohelix querythat validates the constructed request body and prints it (respecting--compact) without loading project configuration or making an HTTP request.query.rs:dry_run: boolis added torun(); the early-return branch fires aftervalidate_dynamic_requestbut beforeProjectContext::find_and_load, plus aformat_query_requesthelper and two unit tests.main.rs: Adds thedry_runfield to theQueryenum variant, wires it into the call site, and adds a parser-level test.chef.rs/README.md: Mechanical signature update and doc update respectively.Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[helix query ...args] --> B[parse_query_request\nfile / json / ts / ts_file] B --> C{parse OK?} C -- error --> Z1[return Err] C -- ok --> D[validate_dynamic_request\nrequest_type + warm check] D --> E{valid?} E -- error --> Z2[return Err] E -- ok --> F{--dry-run?} F -- yes --> G{verbosity\nshow_normal?} G -- yes --> H[format_query_request\npretty or compact] H --> I[println! request body] I --> J[return Ok] G -- no --> J F -- no --> K[ProjectContext::find_and_load\n+ dotenvy .env] K --> L[build reqwest request\nLocal or Enterprise] L --> M[POST /v1/query] M --> N[print response] N --> JReviews (1): Last reviewed commit: "feat(cli): add query dry-run mode" | Re-trigger Greptile