-
Notifications
You must be signed in to change notification settings - Fork 135
feat: add support for .cursor/rules #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
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
This was referenced Mar 15, 2025
This was referenced Mar 16, 2025
ezyang
added a commit
that referenced
this pull request
Mar 16, 2025
Let's add support for .cursor/rules. These folders can live in any directory in a project and contain mdc files each of which have this format (triple hyphen, key-colon-values, triple hyphen, markdown payload). Rule traversal in codemcp/tools/read_file.py and codemcp/tools/user_prompt.py have duplicate logic for finding rules. Refactor it into a helper function. The helper function should have an optional argument for path, and the code should be generic for when you have path and when you don't. ```git-revs d997f92 (Base revision) 8c45e42 Add pyyaml dependency for parsing MDC files b4247d4 Add find_git_root to git_query.py __all__ list 07b80ad Add find_git_root function to git_query.py 1fff3b1 Remove find_git_root from common.py __all__ list b9b5698 Remove find_git_root function from common.py 0e59276 Update import in read_file.py to import find_git_root from git_query 86585e4 Update import in user_prompt.py to import find_git_root from git_query 3ea2451 Auto-commit format changes 7a844d8 Auto-commit lint changes 7690b75 Add get_applicable_rules_content to __all__ 88de103 Add get_applicable_rules_content helper function b012162 Update imports to use new helper function a7f147d Update read_file.py to use new helper function 073b97e Update imports in user_prompt.py 5824407 Update user_prompt.py to use new helper function HEAD Auto-commit format changes ``` ghstack-source-id: 6849418 Pull Request resolved: #77
This was referenced Mar 16, 2025
ezyang
added a commit
that referenced
this pull request
Mar 16, 2025
Let's add support for .cursor/rules. These folders can live in any directory in a project and contain mdc files each of which have this format (triple hyphen, key-colon-values, triple hyphen, markdown payload). Rule traversal in codemcp/tools/read_file.py and codemcp/tools/user_prompt.py have duplicate logic for finding rules. Refactor it into a helper function. The helper function should have an optional argument for path, and the code should be generic for when you have path and when you don't. ```git-revs d997f92 (Base revision) 8c45e42 Add pyyaml dependency for parsing MDC files b4247d4 Add find_git_root to git_query.py __all__ list 07b80ad Add find_git_root function to git_query.py 1fff3b1 Remove find_git_root from common.py __all__ list b9b5698 Remove find_git_root function from common.py 0e59276 Update import in read_file.py to import find_git_root from git_query 86585e4 Update import in user_prompt.py to import find_git_root from git_query 3ea2451 Auto-commit format changes 7a844d8 Auto-commit lint changes 7690b75 Add get_applicable_rules_content to __all__ 88de103 Add get_applicable_rules_content helper function b012162 Update imports to use new helper function a7f147d Update read_file.py to use new helper function 073b97e Update imports in user_prompt.py 5824407 Update user_prompt.py to use new helper function HEAD Auto-commit format changes ``` chore: Sample Cursor rule test: implement E2E flow in test_cursor_rules.py using stdio_client Modify test_cursor_rules.py to actually do the E2E flow using stdio_client (look at test_write_file.py for an example). ```git-revs a2a63a8 (Base revision) 72076d8 Implement E2E flow using stdio_client in test_cursor_rules.py 27b2b2f Add missing subprocess import a0351e3 Auto-commit lint changes 08a87ea Update JavaScript file test assertions 2ae058e Update UserPrompt test assertions HEAD Update Python file test assertions ``` test: run and fix failing tests Run and fix tests ```git-revs dabff99 (Base revision) ab40d4e Fix match_file_with_glob to correctly match file paths against glob patterns 0ae4c1e Improve match_file_with_glob to handle **/*.js pattern correctly 109e663 Fix load_rule_from_file to initialize globs as an empty list instead of None da12273 Update Rule class to have non-optional globs field 5a048cd Manually parse frontmatter to handle unquoted glob patterns d3c2684 Improve match_file_with_glob to handle patterns like 'src/**/*.jsx' 4d774b2 Simplify match_file_with_glob function with a more direct approach 53532e6 Auto-commit format changes HEAD Auto-commit lint changes ``` ghstack-source-id: 2cb3add Pull Request resolved: #77
This was referenced Mar 16, 2025
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.
Stack from ghstack (oldest at bottom):
Let's add support for .cursor/rules. These folders can live in any directory in a project and contain mdc files each of which have this format (triple hyphen, key-colon-values, triple hyphen, markdown payload):