Skip to main content

splice_managed_section

Function splice_managed_section 

Source
pub fn splice_managed_section(
    existing: Option<&str>,
    new_block_body: &str,
) -> SpliceOutcome
Expand description

Pure-string idempotent splice: read the existing file (or None), produce the SpliceOutcome that tells the install layer what to write.

new_block_body is the canonical body that should land between the delimiters — typically the full output of render_artifact minus its frontmatter. For files that always own the whole content (Claude SKILL.md, Cursor .mdc), pass render_artifact in full; the delimiter pair appears as the entire body and the function still routes correctly.

I/O-free: testable as a string transformation.