Skip to content

feat(yq): add jq-backed YAML processor - #2266

Merged
chaliy merged 1 commit into
mainfrom
codex/yq-builtin
Aug 6, 2026
Merged

chaliy merged 1 commit into
mainfrom
codex/yq-builtin

Conversation

@chaliy

@chaliy chaliy commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What changed

Replaces the bespoke dotted-path yaml helper with a feature-gated yq builtin backed by the existing jq/jaq evaluator. Agents can process YAML or JSON from stdin/files with identity, nested selection, iteration, select, map, assignment, multi-document streams, YAML/JSON conversion, raw/compact/exit-status/slurp/null-input modes, combined short flags, and atomic in-place updates.

Adds parser/document/depth/output controls, deterministic bounded diagnostics, no-leak property coverage, generated builtin metadata, user docs, limitations, and threat-model entries. TOML/CSV/XML and mikefarah/yq node/style operators remain explicit unsupported boundaries.

Why

The old yaml command implemented a narrow second query language that did not match the jq-style yq surface commonly generated by agents. Sharing jq/jaq avoids duplicate evaluator semantics and inherits its work, deadline, and output controls.

Before / After

Before:

$ printf "items:\n  - type: fruit\n    name: apple\n" | yq ".items[] | select(.type == \"fruit\") | .name"
bash: yq: command not found

After:

$ printf "%s\n" "---" "type: fruit" "name: apple" "---" "type: veg" "name: kale" "---" "type: fruit" "name: pear" | yq -s -o=json -I=0 "[.[] | select(.type == \"fruit\") | .name]"
["apple","pear"]

Proof: 14/14 portable yq specs, 9 yq integration tests, arbitrary-YAML no-leak property, conditional mikefarah/yq differential, WASM feature check, real-rg regression, and post-rebase just pre-pr.

Risk

  • Medium
  • Removes the nonstandard yaml helper and makes yq available with the jq feature. YAML mapping keys sort deterministically at the JSON-value boundary; source order, comments, styles, and anchors are not preserved. Custom tags and non-string keys fail closed. In-place writes depend on VFS sibling rename semantics and are covered for success, parse/filter/exit-status failure, stdout suppression, and mode preservation.

Checklist

  • Tests added or updated
  • Backward compatibility considered

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 5aa58f0 Commit Preview URL

Branch Preview URL
Aug 06 2026, 01:15 AM

@chaliy
chaliy force-pushed the codex/yq-builtin branch from c85812d to 4648bc9 Compare August 6, 2026 01:01
@chaliy
chaliy force-pushed the codex/yq-builtin branch from 4648bc9 to 5aa58f0 Compare August 6, 2026 01:14
@chaliy
chaliy merged commit fc53a12 into main Aug 6, 2026
46 checks passed
@chaliy
chaliy deleted the codex/yq-builtin branch August 6, 2026 01:28
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