Skip to content

feat: Respect Cursor rules if present#19

Merged
jacsamell merged 1 commit into
mainfrom
cursorrules
Jun 13, 2025
Merged

feat: Respect Cursor rules if present#19
jacsamell merged 1 commit into
mainfrom
cursorrules

Conversation

@jacsamell
Copy link
Copy Markdown
Owner

@jacsamell jacsamell commented Jun 12, 2025

PR Type

Enhancement, Bug fix, Tests


Description

• Add Cursor rules support to respect repository coding standards
• Integrate rules into all AI-powered PR tools automatically
• Support modern .cursor/rules/*.mdc and legacy .cursorrules formats
• Fix GitHub Action output handling when environment unavailable


Changes walkthrough 📝

Relevant files
Enhancement
9 files
cursor_claude_rules.py
Add CursorRulesHandler for loading repository rules           
+128/-0 
utils.py
Add repository rules integration utilities                             
+95/-0   
pr_add_docs.py
Integrate repository rules into documentation prompts       
+5/-0     
pr_code_suggestions.py
Add repository rules to code suggestions                                 
+5/-0     
pr_description.py
Include repository rules in description generation             
+4/-0     
pr_line_questions.py
Apply repository rules to line questions                                 
+5/-0     
pr_questions.py
Add repository rules to general questions                               
+5/-0     
pr_reviewer.py
Integrate rules and refine auto-approval logic                     
+25/-14 
test-pr-bot-dev.yml
Add development testing workflow with Cursor rules             
+65/-0   
Bug fix
1 files
utils.py
Fix GitHub Action output environment check                             
+7/-1     
Tests
1 files
test_cursor_rules.py
Add comprehensive test suite for Cursor rules                       
+262/-0 
Documentation
3 files
python.mdc
Add example Python coding rules file                                         
+49/-0   
.cursorrules
Add legacy format rules file example                                         
+46/-0   
README.md
Document Cursor rules support and usage                                   
+52/-0   
Miscellaneous
1 files
test-action.yml
Remove old test action workflow                                                   
+0/-42   
Configuration changes
2 files
action.yaml
Add Cursor rules configuration input parameter                     
+5/-0     
configuration.toml
Enable Cursor rules by default in settings                             
+3/-0     
Dependencies
1 files
requirements.txt
Update aiohttp version requirement                                             
+1/-1     

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link
    Copy Markdown
    Contributor

    github-actions Bot commented Jun 12, 2025

    PR Reviewer Guide 🔍

    (Review updated until commit fb0783f)

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
     AI Review Score: 83%
    🧪 PR contains tests
     Confidence score [1-100]: 85
     Complexity score [1-10]: 6
     Security score [1-10]: 9
     Auto approve recommendation: false
     Auto approve reasoning: This is a substantial feature addition that introduces a new system for handling repository-specific coding rules. While the code quality is good with proper error handling and testing, it requires human review due to the scope of changes, integration across multiple tools, and potential impact on AI prompt generation behavior.
     Requires human approval: Complex Feature Addition
    💡 Code suggestions

    Type Hint Compatibility

    Use typing.Tuple instead of built-in tuple for better Python version compatibility.

    Existing code:

    def _load_mdc_files(self, branch: str) -> tuple[Optional[str], list[str]]:
    

    Improved code:

    def _load_mdc_files(self, branch: str) -> Tuple[Optional[str], List[str]]:
    
    Error Message Clarity

    Make the debug message more descriptive about what happens when GITHUB_OUTPUT is not set.

    Existing code:

    get_logger().debug("GITHUB_OUTPUT environment variable not set, skipping action output")
    

    Improved code:

    get_logger().debug("GITHUB_OUTPUT environment variable not set, skipping GitHub Action output generation")
    
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Private Method Usage

    The code uses a private method _get_repo() from the git provider, which could break with future updates. Consider using a public API or adding proper error handling for when this method becomes unavailable.

    repo = self.git_provider._get_repo()
    directory_contents = repo.get_contents(self.CURSOR_RULES_DIR, ref=branch)
    Python Version Compatibility

    The type hint tuple[Optional[str], list[str]] requires Python 3.9+. Consider using Tuple[Optional[str], List[str]] from typing module for better compatibility.

    def _load_mdc_files(self, branch: str) -> tuple[Optional[str], list[str]]:

    🔍 Manual review required

    Reason: Manual review required: Complex Feature Addition

    @jacsamell jacsamell merged commit 9a5d34f into main Jun 13, 2025
    2 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    1 participant