Span-preserving YAML field editing (TypeScript surface)
State: open/verified · Kind: module · Audience: system
Summary
Section titled “Summary”- Pure, deterministic, span-preserving YAML field editing over bytes, surfaced to TypeScript as
@sksizer/yaml-splice— a hand-written typed façade over theyaml-spliceRust 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.
Statement
Section titled “Statement”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.
What it provides
Section titled “What it provides”- 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
Underlying implementation
Section titled “Underlying implementation”- 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)
Locations
Section titled “Locations”packages/ts/yaml-splice/index.tspackages/ts/yaml-splice/index.ts#editYamlpackages/ts/yaml-splice/packages/ts/yaml-splice/wasm/packages/rust/yaml-splice/packages/rust/yaml-splice/src/edit.rs#edit_yamlpackages/rust/yaml-splice-wasm/packages/rust/yaml-splice-wasm/src/lib.rs#edit_yaml_wasm