story-kit: merge 267_story_mcp_update_story_tool_should_support_front_matter_fields

This commit is contained in:
Dave
2026-03-17 17:33:30 +00:00
parent 1f8ffee38e
commit f72666b39e
3 changed files with 102 additions and 10 deletions

View File

@@ -161,7 +161,7 @@ fn remove_front_matter_field(contents: &str, key: &str) -> String {
/// Insert or update a key: value pair in the YAML front matter of a markdown string.
///
/// If no front matter (opening `---`) is found, returns the content unchanged.
fn set_front_matter_field(contents: &str, key: &str, value: &str) -> String {
pub fn set_front_matter_field(contents: &str, key: &str, value: &str) -> String {
let mut lines: Vec<String> = contents.lines().map(String::from).collect();
if lines.is_empty() || lines[0].trim() != "---" {
return contents.to_string();