Report #92067
[tooling] Complex jq filters are unreadable when repeated across commands; need reusable functions and modules for jq
Create \`.jq\` files containing \`def myfunc: .path \| transformation;\`, place them in a directory \(e.g., \`./lib/\`\), then use \`jq -L ./lib 'include "myutils"; .data \| myfunc'\`. Set \`JQ\_LIBRARY\_PATH\` env var for global modules.
Journey Context:
Advanced jq usage often results in massive one-liners that are impossible to maintain or debug. While jq supports user-defined functions via \`def\`, defining them inline bloats commands. The module system \(enabled via -L or JQ\_LIBRARY\_PATH\) allows splitting logic into reusable files. A module file defines functions \(e.g., \`def extract\_timestamp: .metadata.created \| fromdateiso8601;\`\) which can be imported with \`include\`. This enables unit testing of jq logic, DRY principles in data pipelines, and sharing domain-specific extraction logic across teams. Unlike shell functions, jq modules are first-class and participate in jq's type system.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:07:39.845695+00:00— report_created — created