Skip to content

fix(skill_engine): serialize non-string frontmatter scalars#104

Open
santhreal wants to merge 2 commits into
HKUDS:mainfrom
santhreal:fix/normalize-frontmatter-nonstring
Open

fix(skill_engine): serialize non-string frontmatter scalars#104
santhreal wants to merge 2 commits into
HKUDS:mainfrom
santhreal:fix/normalize-frontmatter-nonstring

Conversation

@santhreal

Copy link
Copy Markdown

normalize_frontmatter re-emits SKILL.md YAML after PyYAML parse. Valid scalars such as enabled: true and created: 2024-01-01 became bool/int/date objects, then _yaml_quote raised TypeError (or a date dump leaked a ... document end into the file).

Non-string values now go through yaml.safe_dump(...).splitlines()[0]; strings still use _yaml_quote.

Repro: normalize_frontmatter("---\\nname: demo\\nenabled: true\\n---\\n") TypeError'd on main and now re-emits enabled: true.

PyYAML returns bool/int/list for valid SKILL.md fields; passing those
into _yaml_quote raised TypeError. Format scalars before re-emit.
Avoid PyYAML document-end markers leaking into SKILL.md frontmatter
when normalizing dates and other non-string scalars.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant