Files
conorbronsdon__avoid-ai-wri…/scripts
Conor Bronsdon def5e3825f Drop frontmatter metadata from the OpenAI copy of the canonical skill (#146)
* Drop frontmatter metadata from the OpenAI copy of the canonical skill

The OpenAI plugin portal rejected the Skills-only ZIP on
skills/avoid-ai-writing/SKILL.md: "Skill interface settings must use
agents/openai.yaml ... `metadata` in SKILL.md does not configure the skill
interface." That copy was byte-identical to root SKILL.md, whose frontmatter
carries an agentskills.io/OpenClaw `metadata` block (author, repository,
tags, agentskills_spec, openclaw.emoji).

- sync-plugin-skill.sh writes the OpenAI copy with the `metadata` block
  removed from the frontmatter; everything else stays identical. The Claude
  plugin copy is unchanged.
- validate-openai-plugin.py compares root-minus-metadata to the copy for its
  drift check and rejects a `metadata` key in any packaged skill's SKILL.md,
  so the portal error cannot recur silently.
- validate-openai-plugin.test.py covers the transform (body untouched,
  version/license/compatibility kept, no-frontmatter passthrough, copy in
  sync) and three red controls: a byte-identical copy fails both rules, a
  body edit still reads as drift, and `metadata` in another skill fails.

Verified: validate-openai-plugin.test.py, validate-openai-plugin.py . (OK),
npm test, and the rebuilt archive validates after extraction. The rebuilt
ZIP was accepted by the portal's upload validation.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UaeXzpBoBZKa1dWxVS1bTE

* Single-source the metadata strip and correct the exact-copy wording

Codex review of the previous commit found the awk and Python transforms
could diverge (CRLF files, a frontmatter without a closing delimiter, a
missing final newline) and that both ended the metadata block at a blank
line, leaving orphaned nested keys.

- sync-plugin-skill.sh now calls validate-openai-plugin.py
  --strip-frontmatter-metadata, so one implementation produces the copy and
  checks it.
- strip_frontmatter_metadata keeps line endings byte-exact, treats blank
  lines inside the block as part of it, and returns text without a
  well-formed frontmatter unchanged; the drift check compares bytes again.
- Tests add the edge inputs from the review and a CLI-vs-function
  byte-equality check.
- OPENAI_PLUGIN.md, NOTICE.md, and submission-pack.json no longer call the
  bundled copy an exact copy; they state the one omitted block.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UaeXzpBoBZKa1dWxVS1bTE

* Match only the top-level metadata key and keep comments inside the block

Codex second pass: `metadata:extra:` is a distinct YAML key and was being
stripped by the prefix match; a column-zero `#` comment inside the metadata
block ended the block early and left an orphaned nested key. The key match
now requires whitespace or end of line after `metadata:`, comment lines
inside the block are skipped with it, and both cases have tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UaeXzpBoBZKa1dWxVS1bTE

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-04 19:10:32 -07:00
..