Skip to content

v0.8.0

Choose a tag to compare

@zekaizer zekaizer released this 11 Aug 06:38
· 91 commits to main since this release

A one-character typo fix no longer costs a full read-and-rewrite of the surrounding section (ADR-0027).

Features

  • New tool replace_text. One item = one (note, find) literal substitution inside a note body; frontmatter is never searched (that stays edit_properties' domain). Matching is byte-exact — no regex, no case folding, no CJK spacing/markup folding — so the replaced span is never in question. By default find must occur exactly once: 0 matches reject with NOT_FOUND, 2+ with AMBIGUOUS; replace_all: true or expected_count: <n> takes every match. Optional heading_path (plus scope and expected_hash) narrows the search to one section, and dry_run: true reports the matches without writing.
  • Batches stay order-independent. Every item resolves its match spans against the unedited note and intersecting spans reject the batch (OVERLAP), so no item ever sees another item's output. All-or-nothing, like the other destructive tools.
  • Responses report positions, not prose. Per item: the replacement count plus the first few changed lines, numbered in the resulting note — never the note body, which is precisely the payload the tool exists to avoid.
  • New error code COUNT_MISMATCH for a violated expected_count.

Fixes

  • make check is green again. The stdio end-to-end suite still read read_outlines as a heading array, which v0.7.0 replaced with a text block, and four files no longer matched the rustfmt of the pinned toolchain — both gate stages had been failing.
  • The tool-annotation test now asserts that every registered tool is classified, which its comment claimed but the check did not do.

Notes

  • Measured on a real vault (259 notes): median note 12.5 KB, median leaf section 425 B (p90 1.4 KB). The old typo path — read_outlines for the address, read_sections for the bytes, edit_sections to send them back — moved roughly a kilobyte in each direction for a few bytes of actual change.
  • Structural change (adding, deleting, moving, renaming sections) stays with edit_sections: replace_text edits body text and does not validate heading levels.
  • search_notes still NFC-normalizes and folds CJK gaps, so a hit it finds may not match find byte-for-byte (전역지침 finds 전역 지침; replacing it does not). This asymmetry is deliberate — search may guess, a destructive edit may not — and the tool description says so.