Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Refactor ExecuteAsync to support JqParams and JqResult

  • Create JqParams class with properties for all jq command-line parameters
    • Add properties for: RawOutput, CompactOutput, MonochromeOutput, ColorOutput, Slurp, NullInput, ExitStatus, Args, ArgsJson, etc.
    • Make Query a required constructor parameter (non-nullable)
  • Create JqResult class with ExitCode, StandardOutput, and StandardError
    • Add implicit conversion operator to string (returns StandardOutput)
  • Create new ExecuteAsync(JqParams params) method that returns Task<JqResult>
  • Update existing ExecuteAsync(string json, string query) to use new implementation
    • Construct JqParams internally
    • Call new ExecuteAsync
    • Return StandardOutput for backward compatibility
  • Keep all classes in single JQ.cs file
  • Add comprehensive tests for new functionality
  • Ensure all existing tests continue to pass (13 tests passing)
  • Add security validations
    • Validate file existence for SlurpFiles and RawFiles to prevent path traversal
    • Validate that either Json is provided or NullInput is true to prevent hanging
    • Validate Query is not null or empty in constructor
  • Fix documentation for JoinOutput and Tab parameters
  • Document changes in readme with usage examples
Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for all JQ parameters and result exit code, standard output and errors</issue_title>
<issue_description>Refactor the ExecuteAsync so that it receives a JqParams and returns a JqResult.

JqResult should provide the ExitCode, StandardOutput and StandardError from the process for futher inspection. An implicit conversion to string (returning the StandardOutput) should be provided for source compatibility with previous versions.

JqParams should allow providing typed arguments supported by the underlying jq (see docs at https://jqlang.org/).

The existing overload receiving string json, string query should construct the JqParams and invoke the single implementation and return the StandardOutput for backs compat.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 15, 2026 20:29
Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor ExecuteAsync to support JQ parameters and result Add JqParams and JqResult to expose full jq CLI capabilities and process metadata Jan 15, 2026
Copilot AI requested a review from kzu January 15, 2026 20:35
Copy link
Member

@kzu kzu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you document the changes in the readme

Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 16, 2026

Make sure you document the changes in the readme

Added documentation for JqParams and JqResult to the readme with usage examples showing both simple and advanced scenarios. See commit 928e499.

The documentation includes:

  • Simple usage example (existing API)
  • Advanced usage with JqParams and JqResult
  • Description of JqResult properties (ExitCode, StandardOutput, StandardError, implicit conversion)
  • List of supported JqParams options (output, processing, and variable passing)

Copilot AI requested a review from kzu January 16, 2026 00:29
@kzu kzu marked this pull request as ready for review January 17, 2026 18:44
Copilot AI and others added 2 commits January 17, 2026 18:44
Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Copilot AI requested a review from kzu January 17, 2026 18:49
@kzu kzu enabled auto-merge (rebase) January 17, 2026 18:50
@kzu kzu merged commit ec9723e into main Jan 17, 2026
5 checks passed
@kzu kzu deleted the copilot/refactor-executeasync-for-jq branch January 17, 2026 18:52
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.

Add support for all JQ parameters and result exit code, standard output and errors

2 participants