Skip to content

cli-preference: jaq is not a drop-in for jq - #45

Merged
UnbreakableMJ merged 2 commits into
mainfrom
fix/jaq-compat-reference
Aug 24, 2026
Merged

cli-preference: jaq is not a drop-in for jq#45
UnbreakableMJ merged 2 commits into
mainfrom
fix/jaq-compat-reference

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

The references/jaq.md Gotchas section said only that "a handful of exotic jq features aren't supported" and that --stream is missing. Measured against jq 1.8.1, that is a serious understatement — and the page was recommending a command that silently does the wrong thing.

The substantive gap: auto-vivification

echo 'null' | jq  '.a.b = 1'   # {"a":{"b":1}}
echo 'null' | jaq '.a.b = 1'   # Error: cannot use null as iterable

jq creates missing containers along an assignment path; jaq does not. Every "build the object as you go" idiom breaks, including reduce … (null; .[$k] = …).

A recommended example that was wrong

Example 6 was jaq -s 'add' a.json b.json. jaq slurps per file and runs the filter once per input, so that command prints two results where the reader plainly expects one. Corrected to a single file, with the divergence spelled out.

Also recorded

  • Output-format flags are not last-wins under jaq (jq -c --tab pretty-prints; jaq -c --tab is compact).
  • 22 jq builtins are missing; 9 jq flags are rejected with unknown flag.
  • "a" * 0 is null (jq: ""); 1 / 0 is Infinity — invalid JSON on stdout.
  • jaq has -i/--in-place, which jq does not. Worth stating explicitly: anything that forwards unrecognised flags to jaq can turn a jq typo into a file rewrite.

Pointer

Pathfinder is the shim for keeping existing jq scripts working. The §3 mapping-table row is updated to say jaq is not alias-safe.

The SKILL.md frontmatter description is untouched and remains 986 characters, within the §5.6 cap.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c586881235

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

| `top` / `htop` | `bottom` 🦀 (`btm`) | `references/bottom.md` | Graphs, network, processes |
| `cd` + history | `zoxide` 🦀 (`z`) | `references/zoxide.md` | Shell init required |
| `jq` | `jaq` 🦀 | `references/jaq.md` | Faster; near-identical syntax |
| `jq` | `jaq` 🦀 | `references/jaq.md` | Faster. **Not alias-safe** — no auto-vivification; use `pathfinder` for existing jq scripts |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Rebuild and commit both skill bundles

This commit edits the skill source but leaves spacecraft-cli-preference.zip and spacecraft-cli-preference.skill byte-for-byte at their parent versions, so consumers installing either bundle still receive the old alias-safe guidance and incorrect multi-file slurp example instead of these corrections. Rebuild and include both bundles with the source changes.

AGENTS.md reference: AGENTS.md:L95-L98

Useful? React with 👍 / 👎.

UnbreakableMJ and others added 2 commits August 25, 2026 00:47
The reference's Gotchas said only that "a handful of exotic jq features aren't
supported" and that `--stream` is missing. Measured against jq 1.8.1 that is a
serious understatement, and the page was recommending a command that silently
does the wrong thing.

The substantive gap is auto-vivification: jq creates missing containers along an
assignment path and jaq does not, so `echo null | jaq '.a.b = 1'` errors where
jq returns {"a":{"b":1}}. Every "build the object as you go" idiom breaks.

Example 6 was `jaq -s 'add' a.json b.json`. jaq slurps per file and runs the
filter once per input, so that command prints two results where the reader
plainly expects one. Corrected to a single file with the divergence called out.

Also records: output-format flags are not last-wins under jaq, 22 jq builtins
are missing, 9 jq flags are rejected, and the arithmetic corners. Adds the
warning that jaq has `-i/--in-place` where jq does not, so an unrecognised flag
must never be passed through blindly.

Points at Pathfinder for the case where existing jq scripts have to keep
working, and marks the §3 mapping-table row as not alias-safe.

The SKILL.md frontmatter description is untouched and remains 986 characters,
within the §5.6 cap.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011r8wNFByLqoc2ZWevWUUMu
PR #45 edited spacecraft-cli-preference/SKILL.md and references/jaq.md without
rebuilding the two bundles that are the install surface, so every consumer
installing from the zip would still get the old "near drop-in" claim and the
wrong slurp example.

Rebuilt both from the rebased branch, so they also carry the LICENSE file that
landed in #47.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M94JK8t6zguGCTDP7udiUv
@UnbreakableMJ
UnbreakableMJ force-pushed the fix/jaq-compat-reference branch from c586881 to c88bdb1 Compare August 24, 2026 21:48
@UnbreakableMJ
UnbreakableMJ merged commit c2d158b into main Aug 24, 2026
3 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the fix/jaq-compat-reference branch August 24, 2026 22:02
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