fix: prepend YAML frontmatter to Cursor .mdc files#1699
Open
fsilvaortiz wants to merge 1 commit intogithub:mainfrom
Open
fix: prepend YAML frontmatter to Cursor .mdc files#1699fsilvaortiz wants to merge 1 commit intogithub:mainfrom
fsilvaortiz wants to merge 1 commit intogithub:mainfrom
Conversation
Cursor IDE requires YAML frontmatter with `alwaysApply: true` in .mdc rule files for them to be automatically loaded. Without this frontmatter, users must manually configure glob patterns for the rules to take effect. This fix adds frontmatter generation to both the bash and PowerShell update-agent-context scripts, handling three scenarios: - New .mdc file creation (frontmatter prepended after template processing) - Existing .mdc file update without frontmatter (frontmatter added) - Existing .mdc file with frontmatter (no duplication) Closes github#669 🤖 Generated with [Claude Code](https://claude.com/code) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
alwaysApply: true) in.mdcrule files for auto-inclusion — without it, rules are silently ignoredscripts/bash/update-agent-context.shandscripts/powershell/update-agent-context.ps1Closes #669
Changes
scripts/bash/update-agent-context.sh: Added frontmatter prepend increate_new_agent_file()andupdate_existing_agent_file()scripts/powershell/update-agent-context.ps1: Added frontmatter prepend inNew-AgentFileandUpdate-ExistingAgentFiletests/test_cursor_frontmatter.py: 7 new tests (3 static analysis + 4 integration)Test plan
.mdcfrontmatter logic in both functions.mdcfrontmatter logic in both functions.mdcfile starts with valid YAML frontmatter (---,alwaysApply: true,---).mdcfile without frontmatter gets it prepended on update.mdcfile with frontmatter does NOT get duplicated.mdcfiles (e.g., Claude'sCLAUDE.md) are NOT affected🤖 Generated with Claude Code