Skip to content

Preserve SKILL.md formatting during version bumps - #7

Merged
patbeqo merged 1 commit into
mainfrom
fix/preserve-skill-formatting
Sep 4, 2026
Merged

Preserve SKILL.md formatting during version bumps#7
patbeqo merged 1 commit into
mainfrom
fix/preserve-skill-formatting

Conversation

@patbeqo

@patbeqo patbeqo commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace only the existing SKILL.md version value instead of serializing all frontmatter
  • preserve quotes, comments, line endings, body content, and final-newline state
  • remove the unused python-frontmatter dependency

Tests

  • python .github/scripts/tests/test_bump_version.py -v
  • python .github/scripts/tests/test_validate_rollback_version.py -v

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T16:23:19.489806Z 429ff6e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@patbeqo
patbeqo merged commit 8381b75 into main Sep 4, 2026
5 checks passed
@patbeqo
patbeqo deleted the fix/preserve-skill-formatting branch September 4, 2026 16:20

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 429ff6e58b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

re.DOTALL,
)
VERSION = re.compile(
r"^version[ \t]*:[ \t]*"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle valid YAML key syntax when matching versions

When a valid SKILL.md indents its root mapping ( version: 0.5.0) or quotes the key ("version": 0.5.0), this anchored literal finds zero matches and set_version raises. The previous python-frontmatter implementation parsed both forms as the version field, so the Bump version step in .github/workflows/bump-skill.yml can now abort for previously supported frontmatter; parse the key structurally or support these valid YAML forms.

Useful? React with 👍 / 👎.



FRONTMATTER = re.compile(
r"\A---\r?\n(?P<body>.*?)(?=\r?\n---(?:\r?\n|\Z))",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept whitespace on frontmatter delimiters

When either delimiter has trailing whitespace, such as --- \n, this expression does not recognize the frontmatter even though that is valid YAML marker syntax and was accepted by the previous python-frontmatter boundary matcher. The release workflow will therefore reject an otherwise valid SKILL.md instead of updating it, which also conflicts with the stated goal of preserving existing formatting.

Useful? React with 👍 / 👎.


def set_version(text: str, version: str) -> str:
if not frontmatter.checks(text):
frontmatter = FRONTMATTER.match(text)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain YAML validation before rewriting frontmatter

When the frontmatter contains malformed YAML outside the version line—for example an unterminated flow sequence in descriptionFRONTMATTER.match and VERSION.finditer still succeed, so the script commits and attempts to release an invalid SKILL.md. The former frontmatter.loads call rejected such input before modifying it; validate the captured document as YAML while still performing the byte-preserving replacement.

Useful? React with 👍 / 👎.

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