Skip to content

Replace legacy custom JSON query syntax with direct jq filters#35

Draft
Copilot wants to merge 3 commits intodevfrom
copilot/remove-php-parser-query-syntax
Draft

Replace legacy custom JSON query syntax with direct jq filters#35
Copilot wants to merge 3 commits intodevfrom
copilot/remove-php-parser-query-syntax

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 2, 2026

This change removes the legacy php-era query DSL from the Cloudflare CLI response path and switches callers to explicit jq filters. The goal is to eliminate both the deprecated php parser behavior and the opaque %, ,, &<... formatting syntax in favor of readable jq expressions.

  • Parser/decoder simplification

    • Removed legacy json_decode/compat translation logic in cf-inc-cf.sh.
    • Simplified jq_decode to execute jq filters directly (while preserving existing API error handling and pagination marker behavior).
    • Updated call_cf_v4 defaults/docs to use jq-native filter semantics.
  • Call-site migration from custom DSL to jq

    • Replaced call_cf_v4 ... -- %"...",... and -- .result '&<"...$var"...' patterns with explicit jq filters.
    • Updated high-traffic paths in cloudflare and cf-inc-cf.sh (zone/account listing, settings output, access-rules, record create/update, zone helper flows).
    • Normalized nullable notes handling in delete-listing TSV output (.notes // "") to avoid null-string artifacts.
  • Requirements/docs alignment

    • Updated runtime dependency docs from php-cli to jq in README.md.
  • Focused coverage

    • Added tests/test-jq-decode.sh to validate jq-filter decoding behavior (TSV output, API-error exit semantics, pagination marker output).

Example migration pattern:

# before
call_cf_v4 GET /zones/$ZONE_ID -- %"%s\t%s\t%s\n" ,name,status,id

# after
call_cf_v4 GET /zones/$ZONE_ID -- '.result | [.name, .status, .id] | @tsv'

💡 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 2 commits March 2, 2026 17:06
Co-authored-by: jordantrizz <345869+jordantrizz@users.noreply.github.com>
Co-authored-by: jordantrizz <345869+jordantrizz@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove PHP-based parser and improve query syntax Replace legacy custom JSON query syntax with direct jq filters Mar 2, 2026
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.

2 participants