Skip to content

Add .[] as jq-compatible alias for [*] and document jq interop#283

Merged
kkozik-amplify merged 1 commit intorelease/8.xfrom
jq-compat
Apr 4, 2026
Merged

Add .[] as jq-compatible alias for [*] and document jq interop#283
kkozik-amplify merged 1 commit intorelease/8.xfrom
jq-compat

Conversation

@kkozik-amplify
Copy link
Copy Markdown
Collaborator

@kkozik-amplify kkozik-amplify commented Apr 3, 2026

Summary

Lowers the learning curve for users coming from jq by adding .[] as an alias for [*] in hq path expressions, and adds documentation showing how hq and jq complement each other.

Changes

  • Add .[][*] normalization in parse_path() so jq-style iteration syntax works in hq queries
  • Add "Piping to jq" section to hq docs with practical examples of combining hq + jq
  • Add "Coming from jq" translation table mapping common jq idioms to their hq equivalents
  • Add unit tests for the .[] alias in standalone, chained, and continuation positions

Manual testing checklist

  • hq 'resource.[]' file.tf produces the same output as hq 'resource[*]' file.tf
  • hq 'resource.[].tags' file.tf works with continuation after the alias
  • Existing [*] queries are unaffected

🤖 Co-Authored-By: Claude Opus 4.6 (1M context) Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kkozik-amplify kkozik-amplify requested a review from a team as a code owner April 3, 2026 18:06
@kkozik-amplify kkozik-amplify merged commit b8f1dfe into release/8.x Apr 4, 2026
7 of 8 checks passed
@kkozik-amplify kkozik-amplify deleted the jq-compat branch April 4, 2026 19:08
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