Repository navigation
pi-snap-edit v4.2.1
pi-snap-edit v4.2.1
Patch release. Makes edit failures machine-readable via structured error payloads, and improves quick_edit usability with start="eof" appends, an indent_tolerant whitespace shortcut, and optional end-line/count guards — all without weakening fail-closed atomic semantics.
Changes
- Structured failures: new
SnapEditErrorwith stableerror_code, optionalcandidates/suggestedretry fields, and a trailing--- snap-edit-error ---JSON block. ExportsparseSnapEditError/SnapEditErrorfor engines, tools, and tests.quick_editandtarget_editvalidation/mismatch paths now route throughthrowEditError, keeping human diagnostic prose above the JSON. quick_editUX:- Prefer
start="eof"for appends (noexpectedStartLinerequired); legacystart=lineCount+1inserts still work. - New
whitespace="indent_tolerant"shortcut (trim guards +preserveIndent); explicitexpectedStartLineMatch/preserveIndentstill override. - Optional
expectedEndLineandexpectedLineCountguards for safer multi-line range edits. - Actionable
suggestedretry fields surfaced on errors (relocated start,indent_tolerant).
- Prefer
- Tool guidance: documented
eof, whitespace shortcut, range guards, and structured error parsing inquick_edit/target_editpromptGuidelines. - Tests: added coverage for structured parse paths,
eofappend,indent_tolerant, end/count guards, and target ambiguous/not-found structured payloads.
Install
pi install npm:pi-snap-editVerification
npm run typecheckpassed.npm testpassed (93 tests).git diff --checkpassed.npm pack --dry-runpassed.