Summary
The built-in jq command does not recognize the standard --arg or --slurpfile options in just-bash@3.1.0. These options are needed to bind shell values and JSON files into jq filters without interpolating untrusted values into the filter source.
Reproduction
--arg
echo '["Alice", "Bob"]' | jq --arg name Alice '[.[] | select(. == $name)]'
Actual result:
jq: unrecognized option '--arg'
Expected result:
--slurpfile
printf '["stdout line"]\n' > /tmp/stdout.json
printf '[]\n' > /tmp/log.json
jq --slurpfile stdout /tmp/stdout.json '. += [{stdout: $stdout[0]}]' /tmp/log.json
Actual result:
jq: unrecognized option '--slurpfile'
Expected result:
[
{
"stdout": [
"stdout line"
]
}
]
Use case
Shell scripts commonly use these bindings to construct structured command logs safely:
jq \
--arg command "$command" \
--arg exitCode "$exitCode" \
--slurpfile stdout "$stdoutJson" \
'. += [{command: $command, exitCode: ($exitCode | tonumber), stdout: $stdout[0]}]' \
"$logFile"
Without variable bindings, callers must rewrite valid jq scripts or interpolate shell values into jq source, which is fragile and can introduce injection bugs.
Expected behavior
--arg name value binds value as a string variable.
--slurpfile name file parses all JSON values in file and binds them as an array.
- Multiple bindings can be combined in one invocation.
- The behavior works with the browser/VFS implementation as well as the Node entry point.
- Invalid JSON and missing option arguments return jq-compatible nonzero statuses and diagnostics.
Prior report
This overlaps #175, which reported --arg against 2.14.0. That issue was closed by its author without maintainer discussion or a linked implementation. The behavior remains reproducible in 3.1.0, and --slurpfile was not covered there.
Summary
The built-in
jqcommand does not recognize the standard--argor--slurpfileoptions injust-bash@3.1.0. These options are needed to bind shell values and JSON files into jq filters without interpolating untrusted values into the filter source.Reproduction
--argActual result:
Expected result:
[ "Alice" ]--slurpfileActual result:
Expected result:
[ { "stdout": [ "stdout line" ] } ]Use case
Shell scripts commonly use these bindings to construct structured command logs safely:
Without variable bindings, callers must rewrite valid jq scripts or interpolate shell values into jq source, which is fragile and can introduce injection bugs.
Expected behavior
--arg name valuebindsvalueas a string variable.--slurpfile name fileparses all JSON values infileand binds them as an array.Prior report
This overlaps #175, which reported
--argagainst2.14.0. That issue was closed by its author without maintainer discussion or a linked implementation. The behavior remains reproducible in3.1.0, and--slurpfilewas not covered there.