feat: add skills.json generation for MCP consumption#72
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughWorkflow renamed to "Update generated files" and extended to run a new script that scans plugin SKILL.md files and emits a timestamped dist/skills.json; the workflow now stages and commits that file alongside PLUGINS.md and README.md when changes are detected. ChangesSkills Index Generation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
nicolethoen
left a comment
There was a problem hiding this comment.
I had claude help me take a look - so i notes a few observations it made.
| value=$(echo "$frontmatter" | grep "^${field}:" | sed "s/^${field}: *//") | ||
|
|
||
| if [ "$value" = ">-" ] || [ "$value" = ">" ] || [ "$value" = "|" ] || [ "$value" = "|-" ]; then | ||
| value=$(echo "$frontmatter" | sed -n "/^${field}:/,/^[a-zA-Z_-]*:\|^---$/{ /^${field}:/d; /^[a-zA-Z_-]*:/d; /^---$/d; p; }" | sed 's/^ *//' | tr '\n' ' ' | sed 's/ *$//') |
There was a problem hiding this comment.
Claude took a look at these regex with me - so take the feedback with a grain of salt.
value=$(echo "$frontmatter" | sed -n "/^${field}:/,/^[a-zA-Z_-]*:\|^---$/{ ... }" ...)
- Regex /^[a-zA-Z_-]*:/ for next field won't match disable-model-invocation: (has hyphen mid-word)
- Won't handle nested YAML (lists, objects)
- Won't escape quotes in multiline strings → breaks JSON
Example failure:
description: >-
Text with "quotes" and
multi-line content
next-field: value # would be captured as part of description
Recommendation:
Use yq (YAML processor) instead of sed:
get_frontmatter_field() {
local file="$1" field="$2"
yq eval ".${field}" <(sed -n '/^---$/,/^---$/p' "$file") | tr -d '\n'
}
Or validate output JSON with jq and fail loudly if malformed.
There was a problem hiding this comment.
looked into this — the - at the end of [a-zA-Z_-] is a literal hyphen so it does match names like disable-model-invocation. and jq --arg handles the JSON escaping for us. same regex pattern from generate-plugins-md.sh that's been working across 28+ skills so i think we're good here. adding yq would be a new CI dependency for something that isn't breaking in practice
Add a bash script that generates dist/skills.json from all SKILL.md files across plugins. The MCP server fetches this at runtime to serve skills via its tool and resource APIs. CI workflow updated to regenerate on every push to main when plugins change. Ref: PF-4034
13d04aa to
0f52de1
Compare
Summary
scripts/generate-skills-json.sh— walks allplugins/*/skills/*/SKILL.mdfiles, extracts frontmatter and content, outputsdist/skills.jsondist/skills.jsonon every push to main whenplugins/**changesdist/skills.json(28 skills)The PatternFly MCP server fetches this file at runtime to serve ai-helpers skills via its tool and resource APIs. No bundled copy, no manual sync — CI keeps it current, the MCP server reads it directly from GitHub.
Ref: PF-4034
Summary by CodeRabbit