Skip to content

Span-preserving YAML field editing (TypeScript surface)

State: open/verified · Kind: module · Audience: system

  • Pure, deterministic, span-preserving YAML field editing over bytes, surfaced to TypeScript as @sksizer/yaml-splice — a hand-written typed façade over the yaml-splice Rust crate compiled to WASM.
  • Set/Remove/Rename edits on a top-level YAML mapping touch only the edited span; every other byte — comments, key order, quoting, BOM, line endings — reserializes identically, and a semantic no-op is a byte-identical no-op.
  • Already shipped and consumed today by SDLC’s own frontmatter/entity-update machinery, not a planned future build like its C-8FKM siblings.

The package is the sole import surface over the generated wasm-bindgen glue committed in its wasm/ subdirectory: it takes a typed FieldEdit[] batch, crosses the JSON-string edit boundary, frees the bindgen handle so no wasm pointer leaks to callers, and maps refusals to a typed EditError with a byte span. It implements no filesystem, markdown, frontmatter-fence, or validation logic itself (D-7N7I) — callers like frontmatter.ts layer that on top.

  • editYaml(source, edits) -> EditOutcome, throwing typed EditError on refusal
  • Typed FieldEdit union (Set/Remove/Rename) over top-level YAML keys
  • Stable EditErrorCode refusal taxonomy with byte-span detail
  • Safe wasm handle lifecycle (guaranteed free()) so no linear-memory pointer escapes
  • packages/ts/yaml-splice/index.ts (hand-written façade)
  • packages/ts/yaml-splice/wasm/ (committed wasm-bindgen glue, built by packages/rust/yaml-splice-wasm/build.sh)
  • packages/rust/yaml-splice (pure crate, D-7N7I-pure-functional-yaml-editing)
  • packages/ts/yaml-splice/index.ts
  • packages/ts/yaml-splice/index.ts#editYaml
  • packages/ts/yaml-splice/
  • packages/ts/yaml-splice/wasm/
  • packages/rust/yaml-splice/
  • packages/rust/yaml-splice/src/edit.rs#edit_yaml
  • packages/rust/yaml-splice-wasm/
  • packages/rust/yaml-splice-wasm/src/lib.rs#edit_yaml_wasm

← Back to Capabilities