mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-27 13:12:55 +08:00
init
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
# Python-generated files
|
||||
__pycache__/
|
||||
*.py[oc]
|
||||
build/
|
||||
dist/
|
||||
wheels/
|
||||
*.egg-info
|
||||
|
||||
# Virtual environments
|
||||
.venv
|
||||
|
||||
awesome-cursorrules/
|
||||
.env
|
||||
@@ -0,0 +1 @@
|
||||
3.11
|
||||
@@ -0,0 +1,54 @@
|
||||
# Cursor Rules MDC Converter
|
||||
|
||||
This script converts Cursor rules from various formats to the `.mdc` format, using LLM to intelligently process and structure the rules.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Install dependencies using `uv`:
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate # On Unix/macOS
|
||||
.venv\Scripts\activate # On Windows
|
||||
uv sync
|
||||
```
|
||||
|
||||
2. Set up your environment variables:
|
||||
Create a `.env` file with your LLM API key:
|
||||
```
|
||||
GEMINI_API_KEY=your_api_key_here
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The script processes files from the `awesome-cursorrules/rules` directory and:
|
||||
1. Creates `.mdc` versions in the same folder as the original files
|
||||
2. Creates a new folder structure in `awesome-cursor-mdc-rules` with the converted files
|
||||
|
||||
### Test Mode
|
||||
|
||||
By default, the script runs in test mode, which only processes 2 folders. To process all folders:
|
||||
|
||||
1. Open `convert_to_mdc.py`
|
||||
2. Find the line `test_mode = True`
|
||||
3. Change it to `test_mode = False`
|
||||
|
||||
### Running the Script
|
||||
|
||||
```bash
|
||||
uv run convert_to_mdc.py
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Retries on API failures with exponential backoff
|
||||
- Processes files in both original location and separate directory
|
||||
- Maintains folder structure
|
||||
- Detailed logging
|
||||
- Test mode for initial validation
|
||||
|
||||
## Error Handling
|
||||
|
||||
The script includes comprehensive error handling:
|
||||
- Logs errors for individual file processing
|
||||
- Continues processing even if some files fail
|
||||
- Retries LLM API calls on failure
|
||||
@@ -0,0 +1,29 @@
|
||||
Project rules offers a powerful and flexible system with path specific configurations. Project rules are stored in the .cursor/rules directory and provide granular control over AI behavior in different parts of your project.
|
||||
|
||||
Here’s how they work
|
||||
|
||||
Semantic Descriptions: Each rule can include a description of when it should be applied
|
||||
File Pattern Matching: Use glob patterns to specify which files/folders the rule applies to
|
||||
Automatic Attachment: Rules can be automatically included when matching files are referenced
|
||||
Reference files: Use @file in your project rules to include them as context when the rule is applied.
|
||||
You can reference rule files using @file, allowing you to chain multiple rules together
|
||||
|
||||
You can create a new rule using the command palette with Cmd + Shift + P > New Cursor Rule. By using project rules you also get the benefit of version control since it’s just a file
|
||||
|
||||
Example use cases:
|
||||
|
||||
Framework-specific rules for certain file types (e.g., SolidJS preferences for .tsx files)
|
||||
Special handling for auto-generated files (e.g., .proto files)
|
||||
Custom UI development patterns
|
||||
Code style and architecture preferences for specific folders
|
||||
|
||||
|
||||
Example rule format (remember that file name should end in .mdc):
|
||||
|
||||
---
|
||||
description: Python general rules
|
||||
globs: /service-1/**/*.*
|
||||
---
|
||||
- Always use UV when installing depdendencies
|
||||
- Always use python 3.12
|
||||
- Always use classes instead of function
|
||||
@@ -0,0 +1,7 @@
|
||||
[project]
|
||||
name = "cursor-rules-mdc"
|
||||
version = "0.1.0"
|
||||
description = "Convert Cursor rules to MDC rules"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = []
|
||||
@@ -0,0 +1,5 @@
|
||||
litellm>=1.30.3
|
||||
python-dotenv>=1.0.1
|
||||
tenacity>=8.2.3
|
||||
ratelimit>=2.2.1
|
||||
pydantic>=2.6.1
|
||||
Reference in New Issue
Block a user