Skip to content

Releases: zoosky/yqr

v0.4.0

Choose a tag to compare

@zoosky zoosky released this 11 Jul 11:59
3ff092a

The fidelity write tier arrives: surgical, byte-preserving edits that change only the bytes a filter targets and leave every other byte -- comments, indentation, quoting, key order -- untouched, or refuse. In the same release, byte-preserving reads become the default and the re-serializing pipeline moves behind --normalize.

Added

  • Write tier: surgical value edits. yqr can now mutate a document through the fidelity engine, changing only the targeted bytes: assignment .a.b = <rhs> (scalar literal or a .-rooted path), append .xs += <item>, new-key assign .a.new = <rhs>, and del(.a.b). Each edit passes through the engine's re-parse guard -- an edit that would restructure the document is refused (exit 5) rather than emitted, and scalar writes are quoted to match the neighbouring style. A filter is either a read-only query or a single mutation; mixing them is a parse error.
  • -i / --in-place flag writes the mutated document back to the input file atomically (temp file + rename, fsync before rename, symlinks followed, owner-only temp permissions). Using -i with stdin or with a read-only filter is an error, diagnosed before any input is read. Without -i, the mutated document is printed to stdout (byte-exact except the edit).
  • Structural delete of multi-line and nested block entries (e.g. del(.spec.template)), which the single-line delete path rejects. Flow-style and sole-entry deletes remain refused with a clear message.
  • --normalize / -N flag for the re-serializing pipeline: it drops comments and canonicalizes scalars (e.g. 007 becomes 7).

Changed

  • Byte-preserving reads are now the default. yqr '.' file.yaml reproduces the input byte-for-byte -- comments, quoting, indentation, scalar spellings, and line endings survive -- with no flag. Untouched nodes are emitted as their original source bytes; computed, absent, and unaddressable nodes fall back to typed rendering per node.
  • --engine now selects the backend for the default (byte-preserving) read. Under --normalize the re-serializing pipeline runs and the engine choice has no observable effect beyond the up-front name validation.

Breaking

  • --preserve / -p removed. Byte preservation is now the default, so the flag is gone. Replace yqr -p '.' f with yqr '.' f; use yqr --normalize '.' f for the re-serializing behaviour.

Security

  • Bumped the transitive crossbeam-epoch pin 0.9.18 -> 0.9.20 to clear RUSTSEC-2026-0204. It reaches the build only through the criterion dev-dependency (benchmarks), so released binaries were never affected; the change is lockfile-only.

Full changelog: https://github.com/zoosky/yqr/blob/v0.4.0/CHANGELOG.md

v0.3.0

Choose a tag to compare

@zoosky zoosky released this 10 Jul 19:05
5f53622

Byte/comment preservation becomes its own flag, decoupled from backend
selection.

Added

  • --preserve / -p flag for byte/comment-preserving reads. It turns on
    fidelity mode with the default backend, so yqr -p '.' file.yaml reproduces
    the input byte-for-byte — comments, quoting, indentation, and line endings
    survive.
  • A runnable demo showcase under docs/content/demo/ (yqr-demo.sh plus sample
    deploy.yaml / config.yaml inputs) walking through navigation, iteration,
    pipes, raw output, and preserve mode.

Changed

  • --engine now selects the backend parser only and no longer implies
    preservation. It picks which library performs a --preserve read (default
    noyalib); whether to preserve is --preserve's job. Without --preserve,
    --engine has no observable effect.

Breaking

  • --engine noyalib '.' no longer preserves bytes on its own — use
    --preserve (optionally with --engine noyalib to name the backend
    explicitly). This decouples backend choice from fidelity mode.

v0.2.1

Choose a tag to compare

@zoosky zoosky released this 10 Jul 15:09
300ca39

noyalib backend engine

v0.2.0

Choose a tag to compare

@zoosky zoosky released this 08 Jul 16:42
c9e432f

Added

  • Fidelity engines for byte-preserving reads, selectable at runtime with the
    new --engine flag. With --engine noyalib or --engine rust-yaml,
    untouched nodes are emitted as their original source bytes — comments,
    quoting, indentation, and line endings survive, and the identity filter
    reproduces the input byte-for-byte.
  • Both fidelity backends now ship in the default build, so --engine noyalib
    and --engine rust-yaml are switchable in one binary without recompiling.
    Build with --no-default-features for a minimal binary that carries neither
    backend (the standard re-serializing pipeline still works; --engine then
    reports the backend as unavailable).
  • A backend-agnostic fidelity round-trip harness (tests/fidelity.rs) that
    checks the parse -> emit == input property across backends, one case per
    formatting dimension (comments, blank lines, indent, quote/block/flow style,
    CRLF, BOM, multi-doc, anchors, numbers, key order).
  • A shared real-world corpus (tests/corpus/) driving both the validation
    suite and the Criterion benchmarks from one case table (Kubernetes, GitHub
    Actions, Docker Compose, Helm, application config).
  • Kubernetes usage guide in the documentation.

Changed

  • An unknown --engine value is now diagnosed before any input is read, so a
    typo is reported immediately instead of after consuming stdin or the file.

v0.1.1

Choose a tag to compare

@zoosky zoosky released this 21 Jun 21:39
e234b55

Packaging-only release: 0.1.1 ships a slim source crate (dev-only files excluded from the package). The compiled code is identical to 0.1.0.

0.1.0 has been yanked; new installs resolve to 0.1.1, and existing pins keep working.

Install with cargo install yqr. See CHANGELOG.md for details.

v0.1.0

Choose a tag to compare

@zoosky zoosky released this 21 Jun 18:58
5039652

First release, published to crates.io: https://crates.io/crates/yqr

yqr is a jq-style Swiss Army knife for YAML: it applies jq-like filter expressions to YAML documents, operating natively on YAML (no JSON round-trip).

M0 (foundation) feature set:

  • Identity ., field access (.foo, .a.b, .["k"])
  • Array indexing (.[n], negative from end) and iteration (.[])
  • Pipe (a | b) and optional error suppression (f?)
  • CLI with --raw-output, file/stdin input, jq-style exit codes

Install with cargo install yqr. Requires Rust 1.96+.