mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-30 23:04:59 +08:00
Refactor project structure and dependencies
- Update pyproject.toml with more flexible Python version support and updated dependencies - Revise README to provide clearer project overview and usage instructions - Enhance configuration and generation scripts with improved path handling and environment validation - Add support for regenerating all libraries and debug mode - Improve error handling and logging - Streamline project setup and deployment processes
This commit is contained in:
@@ -1,157 +1,111 @@
|
|||||||
# MDC Generator for Library Best Practices
|
# MDC Rules Generator
|
||||||
|
|
||||||
This repository contains Cursor rule files (.mdc) that provide AI-powered best practices and guidelines for various libraries and frameworks. The rules in `rules-mdc/` are comprehensive and focused, offering guidance for a wide range of programming libraries and frameworks.
|
This project generates Cursor MDC (Markdown Cursor) rule files from a structured JSON file containing library information. It uses Exa for semantic search and LLM (Gemini) for content generation.
|
||||||
|
|
||||||
## Repository Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
.
|
|
||||||
├── rules-mdc/ # Comprehensive rule files in a flat structure
|
|
||||||
├── cursor-rules-cli/ # Source code and configuration for rule generation
|
|
||||||
│ ├── generate_mdc_files.py
|
|
||||||
│ ├── rules.json
|
|
||||||
│ ├── config.yaml
|
|
||||||
│ └── ...
|
|
||||||
└── logs/ # Log files from rule generation runs
|
|
||||||
```
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Tag-Based Library Organization**: Libraries are organized with tags instead of nested categories for more flexible categorization
|
- Generates comprehensive MDC rule files for libraries
|
||||||
- **Flat Directory Structure**: All MDC files are stored in a single directory for easier access
|
- Uses Exa for semantic web search to gather best practices
|
||||||
- **Configurable**: All settings can be adjusted in `config.yaml`
|
- Leverages LLM to create detailed, structured content
|
||||||
- **Parallel Processing**: Process multiple libraries simultaneously
|
- Supports parallel processing for efficiency
|
||||||
- **Progress Tracking**: Resume from where you left off if the process is interrupted
|
- Tracks progress to allow resuming interrupted runs
|
||||||
- **Smart Glob Pattern Generation**: Automatically determines appropriate glob patterns for different libraries
|
- Smart retry system that focuses on failed libraries by default
|
||||||
- **Rate Limiting**: Configurable API rate limits to avoid throttling
|
|
||||||
- **Robust Error Handling**: Comprehensive error handling and logging
|
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
1. Python 3.8+
|
- Python 3.8+
|
||||||
2. Required packages (install via `uv sync`)
|
- [uv](https://github.com/astral-sh/uv) for dependency management
|
||||||
3. Exa API key (set as environment variable `EXA_API_KEY`)
|
- API keys for:
|
||||||
4. LiteLLM API key (set as environment variable based on your provider)
|
- Exa (for semantic search)
|
||||||
|
- LLM provider (Gemini, OpenAI, or Anthropic)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1. Clone this repository:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
|
||||||
|
cd awesome-cursor-rules-mdc
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Install dependencies using uv:
|
||||||
|
```bash
|
||||||
|
uv sync
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Set up environment variables:
|
||||||
|
Create a `.env` file in the project root with your API keys:
|
||||||
|
```
|
||||||
|
EXA_API_KEY=your_exa_api_key
|
||||||
|
GOOGLE_API_KEY=your_google_api_key # For Gemini
|
||||||
|
# Or use one of these depending on your LLM choice:
|
||||||
|
# OPENAI_API_KEY=your_openai_api_key
|
||||||
|
# ANTHROPIC_API_KEY=your_anthropic_api_key
|
||||||
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The script uses a configuration file (`config.yaml`) with the following structure:
|
The script uses a `config.yaml` file for configuration. You can modify this file to adjust:
|
||||||
|
|
||||||
```yaml
|
- API rate limits
|
||||||
paths:
|
- Output directories
|
||||||
mdc_instructions: "mdc-instructions.txt"
|
- LLM model selection
|
||||||
rules_json: "rules.json"
|
- Processing parameters
|
||||||
output_dir: "rules-mdc"
|
|
||||||
exa_results_dir: "exa_results"
|
|
||||||
|
|
||||||
api:
|
|
||||||
llm_model: "gemini/gemini-2.0-flash"
|
|
||||||
rate_limit_calls: 2000
|
|
||||||
rate_limit_period: 60
|
|
||||||
max_retries: 3
|
|
||||||
retry_min_wait: 4
|
|
||||||
retry_max_wait: 10
|
|
||||||
|
|
||||||
processing:
|
|
||||||
max_workers: 4
|
|
||||||
chunk_size: 50000
|
|
||||||
|
|
||||||
tags:
|
|
||||||
primary_tags: ["python", "javascript", "typescript", "rust", "go", "java", "php", "ruby"]
|
|
||||||
category_tags: ["frontend", "backend", "database", "ai", "ml", "testing", "development"]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Basic Usage
|
Run the script with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run generate_mdc_files.py
|
uv run src/generate_mdc_files.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Test Mode (Process Only One Library)
|
By default, the script will only process libraries that failed in previous runs. This behavior helps ensure reliability and efficiency.
|
||||||
|
|
||||||
|
### Command-line Options
|
||||||
|
|
||||||
|
- `--test`: Run in test mode (process only one library)
|
||||||
|
- `--tag TAG`: Process only libraries with a specific tag
|
||||||
|
- `--library LIBRARY`: Process only a specific library
|
||||||
|
- `--output OUTPUT_DIR`: Specify output directory for MDC files
|
||||||
|
- `--verbose`: Enable verbose logging
|
||||||
|
- `--workers N`: Set number of parallel workers
|
||||||
|
- `--rate-limit N`: Set API rate limit calls per minute
|
||||||
|
- `--regenerate-all`: Process all libraries, including previously completed ones
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
Process failed libraries (default behavior):
|
||||||
```bash
|
```bash
|
||||||
uv run generate_mdc_files.py --test
|
uv run src/generate_mdc_files.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Process Specific Tags or Libraries
|
Regenerate all libraries:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run generate_mdc_files.py --tag python
|
uv run src/generate_mdc_files.py --regenerate-all
|
||||||
uv run generate_mdc_files.py --library react
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Adjust Parallel Processing
|
Process only Python libraries:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run generate_mdc_files.py --workers 8
|
uv run src/generate_mdc_files.py --tag python
|
||||||
```
|
```
|
||||||
|
|
||||||
### Adjust Rate Limits
|
Process a specific library:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run generate_mdc_files.py --rate-limit 50
|
uv run src/generate_mdc_files.py --library react
|
||||||
```
|
```
|
||||||
|
|
||||||
### Verbose Logging
|
## Project Structure
|
||||||
|
|
||||||
```bash
|
- `src/`: Source code directory
|
||||||
uv run generate_mdc_files.py --verbose
|
- `generate_mdc_files.py`: Main script
|
||||||
```
|
- `config.yaml`: Configuration file
|
||||||
|
- `mdc-instructions.txt`: Instructions for MDC generation
|
||||||
|
- `logs/`: Log files directory
|
||||||
|
- `exa_results/`: Directory for Exa search results
|
||||||
|
- `rules.json`: Input file with library information
|
||||||
|
- `rules-mdc/`: Output directory for generated MDC files
|
||||||
|
- `pyproject.toml`: Project dependencies and metadata
|
||||||
|
|
||||||
## File Structure
|
## License
|
||||||
|
|
||||||
The generated MDC files are organized in a flat structure:
|
[MIT License](LICENSE)
|
||||||
|
|
||||||
```
|
|
||||||
rules-mdc/
|
|
||||||
├── react.mdc
|
|
||||||
├── vue.mdc
|
|
||||||
├── django.mdc
|
|
||||||
├── flask.mdc
|
|
||||||
├── pytest.mdc
|
|
||||||
└── ...
|
|
||||||
```
|
|
||||||
|
|
||||||
## Available Libraries
|
|
||||||
|
|
||||||
All currently supported libraries can be found in `rules.json`. This file organizes libraries with tags for flexible categorization:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"libraries": [
|
|
||||||
{
|
|
||||||
"name": "react",
|
|
||||||
"tags": ["frontend", "framework", "javascript"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "django",
|
|
||||||
"tags": ["backend", "framework", "python", "orm", "full-stack"]
|
|
||||||
},
|
|
||||||
...
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The libraries cover a wide range of categories including:
|
|
||||||
- Frontend frameworks and libraries
|
|
||||||
- Backend frameworks
|
|
||||||
- UI libraries and components
|
|
||||||
- State management solutions
|
|
||||||
- Database tools and ORMs
|
|
||||||
- Development tools (testing, linting, etc.)
|
|
||||||
- Cross-platform frameworks
|
|
||||||
- AI/ML libraries
|
|
||||||
- Web technologies
|
|
||||||
- And many more
|
|
||||||
|
|
||||||
## Progress Tracking
|
|
||||||
|
|
||||||
The script maintains a progress file (`mdc_generation_progress.json`) to track which libraries have been processed. This allows you to resume the process if it's interrupted.
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
- If you encounter API rate limit issues, adjust the `rate_limit_calls` in the configuration.
|
|
||||||
- If the script is using too much memory, reduce the `chunk_size` in the configuration.
|
|
||||||
- If the script is too slow, increase the `max_workers` in the configuration (but be mindful of API rate limits).
|
|
||||||
+23
-13
@@ -1,16 +1,26 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "cursor-rules-mdc"
|
name = "mdc-rules-generator"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Convert Cursor rules to MDC rules"
|
description = "Generate Cursor MDC rule files from a structured JSON file"
|
||||||
readme = "README.md"
|
authors = [
|
||||||
requires-python = ">=3.11"
|
{name = "Sanjeed", email = "hi@sanjeed.in"},
|
||||||
dependencies = [
|
|
||||||
"exa-py>=1.8.9",
|
|
||||||
"litellm>=1.61.17",
|
|
||||||
"pydantic>=2.10.6",
|
|
||||||
"python-dotenv>=1.0.1",
|
|
||||||
"ratelimit>=2.2.1",
|
|
||||||
"requests>=2.32.3",
|
|
||||||
"tenacity>=9.0.0",
|
|
||||||
"typing-extensions>=4.12.2",
|
|
||||||
]
|
]
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
readme = "README.md"
|
||||||
|
license = {text = "MIT"}
|
||||||
|
dependencies = [
|
||||||
|
"python-dotenv>=1.0.0",
|
||||||
|
"litellm>=1.0.0",
|
||||||
|
"tenacity>=8.2.3",
|
||||||
|
"ratelimit>=2.2.1",
|
||||||
|
"pydantic>=2.0.0",
|
||||||
|
"exa-py>=1.0.0",
|
||||||
|
"pyyaml>=6.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["src"]
|
||||||
|
|||||||
+11
-2
@@ -1,7 +1,8 @@
|
|||||||
paths:
|
paths:
|
||||||
mdc_instructions: "mdc-instructions.txt"
|
mdc_instructions: "mdc-instructions.txt"
|
||||||
rules_json: "rules.json"
|
rules_json: "../rules.json"
|
||||||
output_dir: "rules-mdc"
|
output_dir: "../rules-mdc"
|
||||||
|
exa_results_dir: "exa_results"
|
||||||
|
|
||||||
api:
|
api:
|
||||||
llm_model: "gemini/gemini-2.0-flash"
|
llm_model: "gemini/gemini-2.0-flash"
|
||||||
@@ -11,6 +12,14 @@ api:
|
|||||||
retry_min_wait: 4
|
retry_min_wait: 4
|
||||||
retry_max_wait: 10
|
retry_max_wait: 10
|
||||||
|
|
||||||
|
exa_api:
|
||||||
|
rate_limit_calls: 5 # Exa rate limit is 5 requests per second
|
||||||
|
rate_limit_period: 1 # Period in seconds
|
||||||
|
max_retries: 3
|
||||||
|
retry_min_wait: 1
|
||||||
|
retry_max_wait: 5
|
||||||
|
|
||||||
processing:
|
processing:
|
||||||
max_workers: 4 # Adjust based on your system's capabilities
|
max_workers: 4 # Adjust based on your system's capabilities
|
||||||
chunk_size: 50000 # Reduced from 50000 to optimize token usage
|
chunk_size: 50000 # Reduced from 50000 to optimize token usage
|
||||||
|
retry_failed_only: true # Default to retry only failed libraries
|
||||||
+201
-123
@@ -15,14 +15,19 @@ from exa_py import Exa
|
|||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import yaml
|
import yaml
|
||||||
|
import sys
|
||||||
|
import shutil
|
||||||
|
|
||||||
# Enable JSON schema validation in LiteLLM
|
# Enable JSON schema validation in LiteLLM
|
||||||
import litellm
|
import litellm
|
||||||
litellm.enable_json_schema_validation = True
|
litellm.enable_json_schema_validation = True
|
||||||
|
|
||||||
|
# Get the script directory for absolute path resolution
|
||||||
|
SCRIPT_DIR = Path(__file__).parent.absolute()
|
||||||
|
|
||||||
# Configure logging
|
# Configure logging
|
||||||
# Create logs directory if it doesn't exist
|
# Create logs directory if it doesn't exist
|
||||||
logs_dir = Path("logs")
|
logs_dir = SCRIPT_DIR / "logs"
|
||||||
logs_dir.mkdir(exist_ok=True)
|
logs_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
# Create a timestamp for the log file
|
# Create a timestamp for the log file
|
||||||
@@ -48,8 +53,8 @@ load_dotenv()
|
|||||||
DEFAULT_CONFIG = {
|
DEFAULT_CONFIG = {
|
||||||
"paths": {
|
"paths": {
|
||||||
"mdc_instructions": "mdc-instructions.txt",
|
"mdc_instructions": "mdc-instructions.txt",
|
||||||
"rules_json": "rules.json",
|
"rules_json": "../rules.json",
|
||||||
"output_dir": "rules-mdc",
|
"output_dir": "../rules-mdc",
|
||||||
"exa_results_dir": "exa_results" # Directory to store Exa results
|
"exa_results_dir": "exa_results" # Directory to store Exa results
|
||||||
},
|
},
|
||||||
"api": {
|
"api": {
|
||||||
@@ -60,16 +65,24 @@ DEFAULT_CONFIG = {
|
|||||||
"retry_min_wait": 4,
|
"retry_min_wait": 4,
|
||||||
"retry_max_wait": 10
|
"retry_max_wait": 10
|
||||||
},
|
},
|
||||||
|
"exa_api": {
|
||||||
|
"rate_limit_calls": 5,
|
||||||
|
"rate_limit_period": 1,
|
||||||
|
"max_retries": 3,
|
||||||
|
"retry_min_wait": 1,
|
||||||
|
"retry_max_wait": 5
|
||||||
|
},
|
||||||
"processing": {
|
"processing": {
|
||||||
"max_workers": 4,
|
"max_workers": 4,
|
||||||
"chunk_size": 50000
|
"chunk_size": 50000,
|
||||||
|
"retry_failed_only": True # Default to retry only failed libraries
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load or create configuration
|
# Load or create configuration
|
||||||
def load_config() -> Dict[str, Any]:
|
def load_config() -> Dict[str, Any]:
|
||||||
"""Load configuration from config.yaml or create default if not exists."""
|
"""Load configuration from config.yaml or create default if not exists."""
|
||||||
config_path = Path("config.yaml")
|
config_path = SCRIPT_DIR / "config.yaml"
|
||||||
if config_path.exists():
|
if config_path.exists():
|
||||||
try:
|
try:
|
||||||
with open(config_path, "r") as f:
|
with open(config_path, "r") as f:
|
||||||
@@ -116,18 +129,22 @@ class LibraryInfo(BaseModel):
|
|||||||
class ProgressTracker:
|
class ProgressTracker:
|
||||||
"""Track progress of MDC generation to allow resuming."""
|
"""Track progress of MDC generation to allow resuming."""
|
||||||
def __init__(self, tracking_file: str = "mdc_generation_progress.json"):
|
def __init__(self, tracking_file: str = "mdc_generation_progress.json"):
|
||||||
self.tracking_file = Path(tracking_file)
|
self.tracking_file = SCRIPT_DIR / tracking_file
|
||||||
self.progress: Dict[str, str] = self._load_progress()
|
self.progress: Dict[str, str] = self._load_progress()
|
||||||
|
logger.debug(f"Loaded progress tracker with {len(self.progress)} entries")
|
||||||
|
|
||||||
def _load_progress(self) -> Dict[str, str]:
|
def _load_progress(self) -> Dict[str, str]:
|
||||||
"""Load existing progress from file."""
|
"""Load existing progress from file."""
|
||||||
if self.tracking_file.exists():
|
if self.tracking_file.exists():
|
||||||
try:
|
try:
|
||||||
with open(self.tracking_file, 'r') as f:
|
with open(self.tracking_file, 'r') as f:
|
||||||
return json.load(f)
|
progress = json.load(f)
|
||||||
|
logger.debug(f"Loaded progress from {self.tracking_file}")
|
||||||
|
return progress
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
logger.warning("Progress file corrupted, starting fresh")
|
logger.warning("Progress file corrupted, starting fresh")
|
||||||
return {}
|
return {}
|
||||||
|
logger.debug(f"Progress file {self.tracking_file} not found, starting fresh")
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def save_progress(self):
|
def save_progress(self):
|
||||||
@@ -139,6 +156,10 @@ class ProgressTracker:
|
|||||||
"""Check if a library has been successfully processed."""
|
"""Check if a library has been successfully processed."""
|
||||||
return self.progress.get(library_key) == "completed"
|
return self.progress.get(library_key) == "completed"
|
||||||
|
|
||||||
|
def is_library_failed(self, library_key: str) -> bool:
|
||||||
|
"""Check if a library has failed processing."""
|
||||||
|
return self.progress.get(library_key) == "failed"
|
||||||
|
|
||||||
def mark_library_completed(self, library_key: str):
|
def mark_library_completed(self, library_key: str):
|
||||||
"""Mark a library as successfully processed."""
|
"""Mark a library as successfully processed."""
|
||||||
self.progress[library_key] = "completed"
|
self.progress[library_key] = "completed"
|
||||||
@@ -149,6 +170,52 @@ class ProgressTracker:
|
|||||||
self.progress[library_key] = "failed"
|
self.progress[library_key] = "failed"
|
||||||
self.save_progress()
|
self.save_progress()
|
||||||
|
|
||||||
|
def get_failed_libraries(self) -> List[str]:
|
||||||
|
"""Get a list of failed libraries."""
|
||||||
|
return [key for key, value in self.progress.items() if value == "failed"]
|
||||||
|
|
||||||
|
def identify_new_libraries(self, all_libraries: List[str]) -> List[str]:
|
||||||
|
"""Identify libraries that are not yet in the progress tracker."""
|
||||||
|
new_libraries = [lib for lib in all_libraries if lib not in self.progress]
|
||||||
|
logger.debug(f"Found {len(new_libraries)} new libraries out of {len(all_libraries)} total libraries")
|
||||||
|
if new_libraries:
|
||||||
|
logger.debug(f"New libraries: {', '.join(new_libraries)}")
|
||||||
|
return new_libraries
|
||||||
|
|
||||||
|
def update_progress_with_new_libraries(self, all_libraries: List[str]) -> List[str]:
|
||||||
|
"""
|
||||||
|
Update progress tracker with new libraries and return the list of newly added libraries.
|
||||||
|
New libraries are marked as not processed (not in the progress tracker).
|
||||||
|
"""
|
||||||
|
new_libraries = self.identify_new_libraries(all_libraries)
|
||||||
|
if new_libraries:
|
||||||
|
logger.info(f"Found {len(new_libraries)} new libraries to process: {', '.join(new_libraries)}")
|
||||||
|
return new_libraries
|
||||||
|
|
||||||
|
def validate_environment_variables() -> bool:
|
||||||
|
"""Validate that all required environment variables are set."""
|
||||||
|
required_vars = []
|
||||||
|
|
||||||
|
# Check for LiteLLM API key (depends on the model being used)
|
||||||
|
model = CONFIG["api"]["llm_model"]
|
||||||
|
if model.startswith("gemini"):
|
||||||
|
required_vars.append("GEMINI_API_KEY")
|
||||||
|
elif model.startswith("gpt") or model.startswith("openai"):
|
||||||
|
required_vars.append("OPENAI_API_KEY")
|
||||||
|
elif model.startswith("claude") or model.startswith("anthropic"):
|
||||||
|
required_vars.append("ANTHROPIC_API_KEY")
|
||||||
|
|
||||||
|
# Check for Exa API key
|
||||||
|
required_vars.append("EXA_API_KEY")
|
||||||
|
|
||||||
|
missing_vars = [var for var in required_vars if not os.getenv(var)]
|
||||||
|
|
||||||
|
if missing_vars:
|
||||||
|
logger.error(f"Missing required environment variables: {', '.join(missing_vars)}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def initialize_exa_client() -> Optional[Exa]:
|
def initialize_exa_client() -> Optional[Exa]:
|
||||||
"""Initialize the Exa client with API key from environment."""
|
"""Initialize the Exa client with API key from environment."""
|
||||||
api_key = os.getenv("EXA_API_KEY")
|
api_key = os.getenv("EXA_API_KEY")
|
||||||
@@ -162,17 +229,26 @@ def initialize_exa_client() -> Optional[Exa]:
|
|||||||
logger.error(f"Failed to initialize Exa client: {str(e)}")
|
logger.error(f"Failed to initialize Exa client: {str(e)}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@retry(stop=stop_after_attempt(CONFIG["api"]["max_retries"]),
|
@retry(stop=stop_after_attempt(CONFIG["exa_api"]["max_retries"]),
|
||||||
wait=wait_exponential(multiplier=1, min=CONFIG["api"]["retry_min_wait"], max=CONFIG["api"]["retry_max_wait"]))
|
wait=wait_exponential(multiplier=1, min=CONFIG["exa_api"]["retry_min_wait"], max=CONFIG["exa_api"]["retry_max_wait"]))
|
||||||
def get_library_best_practices_exa(library_name: str, exa_client: Optional[Exa] = None) -> Dict[str, Any]:
|
@sleep_and_retry
|
||||||
|
@limits(calls=CONFIG["exa_api"]["rate_limit_calls"], period=CONFIG["exa_api"]["rate_limit_period"])
|
||||||
|
def get_library_best_practices_exa(library_name: str, exa_client: Optional[Exa] = None, tags: List[str] = None) -> Dict[str, Any]:
|
||||||
"""Use Exa to search for best practices for a library."""
|
"""Use Exa to search for best practices for a library."""
|
||||||
if exa_client is None:
|
if exa_client is None:
|
||||||
logger.warning("Exa client not initialized, falling back to LLM generation")
|
logger.warning("Exa client not initialized, falling back to LLM generation")
|
||||||
return {"answer": "", "citations": []}
|
return {"answer": "", "citations": []}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Construct a query for best practices
|
# Construct a query for best practices that includes tags for better context
|
||||||
query = f"{library_name} best practices coding standards"
|
if tags and len(tags) > 0:
|
||||||
|
# Select up to 3 most relevant tags to keep the query focused
|
||||||
|
relevant_tags = tags[:3] if len(tags) > 3 else tags
|
||||||
|
tags_str = " ".join(relevant_tags)
|
||||||
|
query = f"{library_name} best practices coding standards for {tags_str} development"
|
||||||
|
else:
|
||||||
|
query = f"{library_name} best practices coding standards"
|
||||||
|
|
||||||
logger.info(f"Searching Exa for: {query}")
|
logger.info(f"Searching Exa for: {query}")
|
||||||
|
|
||||||
# Call Exa API
|
# Call Exa API
|
||||||
@@ -185,7 +261,7 @@ def get_library_best_practices_exa(library_name: str, exa_client: Optional[Exa]
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Save the Exa result to a file
|
# Save the Exa result to a file
|
||||||
exa_results_dir = Path(CONFIG["paths"]["exa_results_dir"])
|
exa_results_dir = SCRIPT_DIR / CONFIG["paths"]["exa_results_dir"]
|
||||||
exa_results_dir.mkdir(parents=True, exist_ok=True)
|
exa_results_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Create a safe filename
|
# Create a safe filename
|
||||||
@@ -209,50 +285,6 @@ def get_library_best_practices_exa(library_name: str, exa_client: Optional[Exa]
|
|||||||
logger.error(f"Error fetching from Exa for {library_name}: {str(e)}")
|
logger.error(f"Error fetching from Exa for {library_name}: {str(e)}")
|
||||||
return {"answer": "", "citations": []}
|
return {"answer": "", "citations": []}
|
||||||
|
|
||||||
def determine_glob_pattern(library_name: str, tags: List[str]) -> str:
|
|
||||||
"""Determine the appropriate glob pattern based on library name and tags."""
|
|
||||||
# Default glob pattern
|
|
||||||
default_glob = "**/*"
|
|
||||||
|
|
||||||
# Check for language-specific patterns
|
|
||||||
if "python" in tags:
|
|
||||||
return "**/*.py"
|
|
||||||
elif "javascript" in tags or "typescript" in tags:
|
|
||||||
if "react" in tags:
|
|
||||||
return "**/*.{jsx,tsx}"
|
|
||||||
elif "vue" in tags:
|
|
||||||
return "**/*.vue"
|
|
||||||
elif "svelte" in tags:
|
|
||||||
return "**/*.svelte"
|
|
||||||
elif "angular" in tags:
|
|
||||||
return "**/*.{ts,html}"
|
|
||||||
return "**/*.{js,ts,jsx,tsx}"
|
|
||||||
elif "rust" in tags:
|
|
||||||
return "**/*.rs"
|
|
||||||
elif "go" in tags:
|
|
||||||
return "**/*.go"
|
|
||||||
elif "java" in tags:
|
|
||||||
return "**/*.java"
|
|
||||||
elif "php" in tags:
|
|
||||||
return "**/*.php"
|
|
||||||
elif "ruby" in tags:
|
|
||||||
return "**/*.rb"
|
|
||||||
|
|
||||||
# Check for specific libraries with known file extensions
|
|
||||||
if library_name == "django":
|
|
||||||
return "**/*.{py,html}"
|
|
||||||
elif library_name == "flask":
|
|
||||||
return "**/*.py"
|
|
||||||
elif library_name == "fastapi":
|
|
||||||
return "**/*.py"
|
|
||||||
elif library_name == "pytest":
|
|
||||||
return "**/test_*.py"
|
|
||||||
elif library_name == "tailwind":
|
|
||||||
return "**/*.{css,html,jsx,tsx}"
|
|
||||||
|
|
||||||
# Return default if no specific pattern found
|
|
||||||
return default_glob
|
|
||||||
|
|
||||||
@sleep_and_retry
|
@sleep_and_retry
|
||||||
@limits(calls=CONFIG["api"]["rate_limit_calls"], period=CONFIG["api"]["rate_limit_period"])
|
@limits(calls=CONFIG["api"]["rate_limit_calls"], period=CONFIG["api"]["rate_limit_period"])
|
||||||
@retry(stop=stop_after_attempt(CONFIG["api"]["max_retries"]),
|
@retry(stop=stop_after_attempt(CONFIG["api"]["max_retries"]),
|
||||||
@@ -261,7 +293,7 @@ def generate_mdc_rules_from_exa(library_info: LibraryInfo, exa_results: Dict[str
|
|||||||
"""Generate MDC rules for a library using LLM directly from Exa results."""
|
"""Generate MDC rules for a library using LLM directly from Exa results."""
|
||||||
try:
|
try:
|
||||||
# Load MDC instructions
|
# Load MDC instructions
|
||||||
mdc_instructions_path = Path(CONFIG["paths"]["mdc_instructions"])
|
mdc_instructions_path = SCRIPT_DIR / CONFIG["paths"]["mdc_instructions"]
|
||||||
if not mdc_instructions_path.exists():
|
if not mdc_instructions_path.exists():
|
||||||
logger.warning(f"MDC instructions file not found at {mdc_instructions_path}")
|
logger.warning(f"MDC instructions file not found at {mdc_instructions_path}")
|
||||||
mdc_instructions = "Create rules with clear descriptions and appropriate glob patterns."
|
mdc_instructions = "Create rules with clear descriptions and appropriate glob patterns."
|
||||||
@@ -287,10 +319,7 @@ def generate_mdc_rules_from_exa(library_info: LibraryInfo, exa_results: Dict[str
|
|||||||
# Combine all citation texts - Gemini can handle much larger inputs
|
# Combine all citation texts - Gemini can handle much larger inputs
|
||||||
all_citation_text = "\n\n".join(citation_texts)
|
all_citation_text = "\n\n".join(citation_texts)
|
||||||
|
|
||||||
# Suggest a glob pattern based on library tags
|
# Format tags for prompt - but don't emphasize them too much
|
||||||
suggested_glob = determine_glob_pattern(library_info.name, library_info.tags)
|
|
||||||
|
|
||||||
# Format tags for prompt
|
|
||||||
tags_str = ", ".join(library_info.tags)
|
tags_str = ", ".join(library_info.tags)
|
||||||
|
|
||||||
# Enhanced prompt template for both cases
|
# Enhanced prompt template for both cases
|
||||||
@@ -301,64 +330,63 @@ def generate_mdc_rules_from_exa(library_info: LibraryInfo, exa_results: Dict[str
|
|||||||
Library Information:
|
Library Information:
|
||||||
- Name: {library_name}
|
- Name: {library_name}
|
||||||
- Tags: {tags}
|
- Tags: {tags}
|
||||||
- Suggested glob pattern: {suggested_glob}
|
|
||||||
|
|
||||||
{exa_content_section}
|
{exa_content_section}
|
||||||
|
|
||||||
Your task is to create an EXTREMELY DETAILED and COMPREHENSIVE guide that covers:
|
Your task is to create an EXTREMELY DETAILED and COMPREHENSIVE guide that covers:
|
||||||
|
|
||||||
1. Code Organization and Structure:
|
1. Code Organization and Structure:
|
||||||
- Directory structure best practices
|
- Directory structure best practices for {library_name}
|
||||||
- File naming conventions
|
- File naming conventions specific to {library_name}
|
||||||
- Module organization
|
- Module organization best practices for projects using {library_name}
|
||||||
- Component architecture
|
- Component architecture recommendations for {library_name}
|
||||||
- Code splitting strategies
|
- Code splitting strategies appropriate for {library_name}
|
||||||
|
|
||||||
2. Common Patterns and Anti-patterns:
|
2. Common Patterns and Anti-patterns:
|
||||||
- Design patterns specific to {library_name}
|
- Design patterns specific to {library_name}
|
||||||
- Recommended approaches for common tasks
|
- Recommended approaches for common tasks with {library_name}
|
||||||
- Anti-patterns and code smells to avoid
|
- Anti-patterns and code smells to avoid when using {library_name}
|
||||||
- State management best practices
|
- State management best practices for {library_name} applications
|
||||||
- Error handling patterns
|
- Error handling patterns appropriate for {library_name}
|
||||||
|
|
||||||
3. Performance Considerations:
|
3. Performance Considerations:
|
||||||
- Optimization techniques
|
- Optimization techniques specific to {library_name}
|
||||||
- Memory management
|
- Memory management considerations for applications using {library_name}
|
||||||
- Rendering optimization
|
- Rendering optimization for {library_name} (if applicable)
|
||||||
- Bundle size optimization
|
- Bundle size optimization strategies for projects using {library_name}
|
||||||
- Lazy loading strategies
|
- Lazy loading strategies appropriate for {library_name}
|
||||||
|
|
||||||
4. Security Best Practices:
|
4. Security Best Practices:
|
||||||
- Common vulnerabilities and how to prevent them
|
- Common vulnerabilities and how to prevent them with {library_name}
|
||||||
- Input validation
|
- Input validation best practices for {library_name}
|
||||||
- Authentication and authorization patterns
|
- Authentication and authorization patterns for {library_name}
|
||||||
- Data protection strategies
|
- Data protection strategies relevant to {library_name}
|
||||||
- Secure API communication
|
- Secure API communication with {library_name}
|
||||||
|
|
||||||
5. Testing Approaches:
|
5. Testing Approaches:
|
||||||
- Unit testing strategies
|
- Unit testing strategies for {library_name} components
|
||||||
- Integration testing
|
- Integration testing approaches for {library_name} applications
|
||||||
- End-to-end testing
|
- End-to-end testing recommendations for {library_name} projects
|
||||||
- Test organization
|
- Test organization best practices for {library_name}
|
||||||
- Mocking and stubbing
|
- Mocking and stubbing techniques specific to {library_name}
|
||||||
|
|
||||||
6. Common Pitfalls and Gotchas:
|
6. Common Pitfalls and Gotchas:
|
||||||
- Frequent mistakes developers make
|
- Frequent mistakes developers make when using {library_name}
|
||||||
- Edge cases to be aware of
|
- Edge cases to be aware of when using {library_name}
|
||||||
- Version-specific issues
|
- Version-specific issues with {library_name}
|
||||||
- Compatibility concerns
|
- Compatibility concerns between {library_name} and other technologies
|
||||||
- Debugging strategies
|
- Debugging strategies for {library_name} applications
|
||||||
|
|
||||||
7. Tooling and Environment:
|
7. Tooling and Environment:
|
||||||
- Recommended development tools
|
- Recommended development tools for {library_name}
|
||||||
- Build configuration
|
- Build configuration best practices for projects using {library_name}
|
||||||
- Linting and formatting
|
- Linting and formatting recommendations for {library_name} code
|
||||||
- Deployment best practices
|
- Deployment best practices for {library_name} applications
|
||||||
- CI/CD integration
|
- CI/CD integration strategies for {library_name} projects
|
||||||
|
|
||||||
Format your response as a valid JSON object with exactly these keys:
|
Format your response as a valid JSON object with exactly these keys:
|
||||||
- name: a short descriptive name for the rule (e.g., "{library_name} Best Practices")
|
- name: a short descriptive name for the rule (e.g., "{library_name} Best Practices")
|
||||||
- glob_pattern: the most appropriate glob pattern for this library based on the file types it typically works with (you can use the suggested pattern or improve it)
|
- glob_pattern: the most appropriate glob pattern for this library based on the file types it typically works with
|
||||||
- description: a clear 1-2 sentence description of what the rule covers
|
- description: a clear 1-2 sentence description of what the rule covers
|
||||||
- content: the formatted rule content with comprehensive best practices in markdown format
|
- content: the formatted rule content with comprehensive best practices in markdown format
|
||||||
"""
|
"""
|
||||||
@@ -375,7 +403,6 @@ Your guidance should be useful for both beginners and experienced developers.
|
|||||||
prompt = enhanced_prompt_template.format(
|
prompt = enhanced_prompt_template.format(
|
||||||
library_name=library_info.name,
|
library_name=library_info.name,
|
||||||
tags=tags_str,
|
tags=tags_str,
|
||||||
suggested_glob=suggested_glob,
|
|
||||||
exa_content_section=exa_content_section,
|
exa_content_section=exa_content_section,
|
||||||
mdc_instructions=mdc_instructions
|
mdc_instructions=mdc_instructions
|
||||||
)
|
)
|
||||||
@@ -397,7 +424,6 @@ Add any important best practices that might be missing from the search results.
|
|||||||
prompt = enhanced_prompt_template.format(
|
prompt = enhanced_prompt_template.format(
|
||||||
library_name=library_info.name,
|
library_name=library_info.name,
|
||||||
tags=tags_str,
|
tags=tags_str,
|
||||||
suggested_glob=suggested_glob,
|
|
||||||
exa_content_section=exa_content_section,
|
exa_content_section=exa_content_section,
|
||||||
mdc_instructions=mdc_instructions
|
mdc_instructions=mdc_instructions
|
||||||
)
|
)
|
||||||
@@ -499,7 +525,7 @@ def process_single_library(library_info: Dict[str, Any], output_dir: str, exa_cl
|
|||||||
|
|
||||||
# Get best practices using Exa
|
# Get best practices using Exa
|
||||||
logger.info(f"Getting best practices for {library_name} using Exa")
|
logger.info(f"Getting best practices for {library_name} using Exa")
|
||||||
exa_results = get_library_best_practices_exa(library_name, exa_client)
|
exa_results = get_library_best_practices_exa(library_name, exa_client, library_tags)
|
||||||
|
|
||||||
# Store citations in library info
|
# Store citations in library info
|
||||||
library_obj.citations = exa_results.get("citations", [])
|
library_obj.citations = exa_results.get("citations", [])
|
||||||
@@ -528,10 +554,12 @@ def process_single_library(library_info: Dict[str, Any], output_dir: str, exa_cl
|
|||||||
return (library_key, False)
|
return (library_key, False)
|
||||||
|
|
||||||
def process_rules_json(json_path: str, output_dir: str, test_mode: bool = False,
|
def process_rules_json(json_path: str, output_dir: str, test_mode: bool = False,
|
||||||
specific_library: Optional[str] = None, specific_tag: Optional[str] = None):
|
specific_library: Optional[str] = None, specific_tag: Optional[str] = None,
|
||||||
|
retry_failed_only: bool = False):
|
||||||
"""Process rules.json and generate MDC files."""
|
"""Process rules.json and generate MDC files."""
|
||||||
# Check if rules.json exists
|
# Check if rules.json exists
|
||||||
if not os.path.exists(json_path):
|
json_path = Path(json_path)
|
||||||
|
if not json_path.exists():
|
||||||
logger.error(f"Rules JSON file not found at {json_path}")
|
logger.error(f"Rules JSON file not found at {json_path}")
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -560,6 +588,12 @@ def process_rules_json(json_path: str, output_dir: str, test_mode: bool = False,
|
|||||||
# Get libraries list
|
# Get libraries list
|
||||||
libraries = libraries_data["libraries"]
|
libraries = libraries_data["libraries"]
|
||||||
|
|
||||||
|
# Extract all library names for progress tracking
|
||||||
|
all_library_names = [lib["name"] for lib in libraries]
|
||||||
|
|
||||||
|
# Check for new libraries and update progress tracker
|
||||||
|
progress_tracker.update_progress_with_new_libraries(all_library_names)
|
||||||
|
|
||||||
# Filter libraries based on target tag or library if specified
|
# Filter libraries based on target tag or library if specified
|
||||||
if specific_library:
|
if specific_library:
|
||||||
filtered_libraries = [lib for lib in libraries if lib["name"] == specific_library]
|
filtered_libraries = [lib for lib in libraries if lib["name"] == specific_library]
|
||||||
@@ -584,17 +618,38 @@ def process_rules_json(json_path: str, output_dir: str, test_mode: bool = False,
|
|||||||
# Prepare list of libraries to process
|
# Prepare list of libraries to process
|
||||||
libraries_to_process = []
|
libraries_to_process = []
|
||||||
|
|
||||||
for library in filtered_libraries:
|
# If retry_failed_only is True, only process libraries that have failed before
|
||||||
# Create a unique key for this library
|
# and any new libraries that have been added
|
||||||
library_key = library["name"]
|
if retry_failed_only:
|
||||||
|
failed_libraries = progress_tracker.get_failed_libraries()
|
||||||
|
new_libraries = progress_tracker.identify_new_libraries(all_library_names)
|
||||||
|
target_libraries = set(failed_libraries).union(set(new_libraries))
|
||||||
|
|
||||||
# Skip if already processed
|
if failed_libraries:
|
||||||
if progress_tracker.is_library_processed(library_key):
|
logger.info(f"Retrying {len(failed_libraries)} failed libraries")
|
||||||
logger.info(f"Skipping already processed library: {library['name']}")
|
if new_libraries:
|
||||||
continue
|
logger.info(f"Processing {len(new_libraries)} new libraries")
|
||||||
|
|
||||||
# Add to processing list
|
for library in filtered_libraries:
|
||||||
libraries_to_process.append(library)
|
library_key = library["name"]
|
||||||
|
if library_key in target_libraries:
|
||||||
|
libraries_to_process.append(library)
|
||||||
|
else:
|
||||||
|
# Normal processing - skip completed libraries
|
||||||
|
for library in filtered_libraries:
|
||||||
|
library_key = library["name"]
|
||||||
|
|
||||||
|
# Skip if already processed
|
||||||
|
if progress_tracker.is_library_processed(library_key):
|
||||||
|
logger.info(f"Skipping already processed library: {library['name']}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Add to processing list
|
||||||
|
libraries_to_process.append(library)
|
||||||
|
|
||||||
|
if not libraries_to_process:
|
||||||
|
logger.info("No libraries to process. All libraries may have been completed already.")
|
||||||
|
return
|
||||||
|
|
||||||
# Process libraries in parallel
|
# Process libraries in parallel
|
||||||
max_workers = CONFIG["processing"]["max_workers"]
|
max_workers = CONFIG["processing"]["max_workers"]
|
||||||
@@ -630,16 +685,18 @@ def main():
|
|||||||
parser.add_argument("--test", action="store_true", help="Run in test mode (process only one library)")
|
parser.add_argument("--test", action="store_true", help="Run in test mode (process only one library)")
|
||||||
parser.add_argument("--tag", type=str, help="Process only libraries with a specific tag")
|
parser.add_argument("--tag", type=str, help="Process only libraries with a specific tag")
|
||||||
parser.add_argument("--library", type=str, help="Process only a specific library")
|
parser.add_argument("--library", type=str, help="Process only a specific library")
|
||||||
parser.add_argument("--output", type=str, default=CONFIG["paths"]["output_dir"], help="Output directory for MDC files")
|
parser.add_argument("--output", type=str, default=None, help="Output directory for MDC files")
|
||||||
parser.add_argument("--verbose", action="store_true", help="Enable verbose logging")
|
parser.add_argument("--verbose", action="store_true", help="Enable verbose logging")
|
||||||
parser.add_argument("--workers", type=int, help=f"Number of parallel workers (default: {CONFIG['processing']['max_workers']})")
|
parser.add_argument("--workers", type=int, help=f"Number of parallel workers (default: {CONFIG['processing']['max_workers']})")
|
||||||
parser.add_argument("--rate-limit", type=int, help=f"API rate limit calls per minute (default: {CONFIG['api']['rate_limit_calls']})")
|
parser.add_argument("--rate-limit", type=int, help=f"API rate limit calls per minute (default: {CONFIG['api']['rate_limit_calls']})")
|
||||||
parser.add_argument("--log-dir", type=str, default="logs", help="Directory to save log files")
|
parser.add_argument("--log-dir", type=str, default="logs", help="Directory to save log files")
|
||||||
parser.add_argument("--exa-results-dir", type=str, default=CONFIG["paths"]["exa_results_dir"], help="Directory to save Exa results")
|
parser.add_argument("--exa-results-dir", type=str, default=None, help="Directory to save Exa results")
|
||||||
|
parser.add_argument("--regenerate-all", action="store_true", help="Regenerate all libraries, including previously completed ones")
|
||||||
|
parser.add_argument("--debug", action="store_true", help="Enable extra debug output")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Set up verbose logging if requested
|
# Set up verbose logging if requested
|
||||||
if args.verbose:
|
if args.verbose or args.debug:
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
@@ -653,18 +710,25 @@ def main():
|
|||||||
if args.exa_results_dir:
|
if args.exa_results_dir:
|
||||||
CONFIG["paths"]["exa_results_dir"] = args.exa_results_dir
|
CONFIG["paths"]["exa_results_dir"] = args.exa_results_dir
|
||||||
|
|
||||||
# Set paths
|
# Set paths with absolute paths
|
||||||
rules_json_path = CONFIG["paths"]["rules_json"]
|
rules_json_path = SCRIPT_DIR / Path(CONFIG["paths"]["rules_json"])
|
||||||
output_dir = args.output or CONFIG["paths"]["output_dir"]
|
output_dir = args.output if args.output else SCRIPT_DIR / Path(CONFIG["paths"]["output_dir"])
|
||||||
|
|
||||||
# Check if rules.json exists
|
# Check if rules.json exists
|
||||||
if not os.path.exists(rules_json_path):
|
if not rules_json_path.exists():
|
||||||
logger.error(f"rules.json not found at {rules_json_path}")
|
logger.error(f"rules.json not found at {rules_json_path}")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if EXA_API_KEY is set
|
# Debug output
|
||||||
if not os.getenv("EXA_API_KEY"):
|
if args.debug:
|
||||||
logger.warning("EXA_API_KEY environment variable not set. Will generate content using LLM only.")
|
logger.debug(f"Rules JSON path: {rules_json_path}")
|
||||||
|
logger.debug(f"Output directory: {output_dir}")
|
||||||
|
logger.debug(f"Config: {CONFIG}")
|
||||||
|
|
||||||
|
# Validate environment variables
|
||||||
|
if not validate_environment_variables():
|
||||||
|
logger.error("Missing required environment variables. Exiting.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Process rules.json and generate MDC files
|
# Process rules.json and generate MDC files
|
||||||
@@ -673,9 +737,23 @@ def main():
|
|||||||
output_dir,
|
output_dir,
|
||||||
test_mode=args.test,
|
test_mode=args.test,
|
||||||
specific_library=args.library,
|
specific_library=args.library,
|
||||||
specific_tag=args.tag
|
specific_tag=args.tag,
|
||||||
|
retry_failed_only=not args.regenerate_all # Invert regenerate-all flag
|
||||||
)
|
)
|
||||||
logger.info("MDC generation completed successfully!")
|
logger.info("MDC generation completed successfully!")
|
||||||
|
|
||||||
|
# Copy rules.json to cursor-rules-cli folder
|
||||||
|
cursor_rules_cli_dir = Path(SCRIPT_DIR).parent / "cursor-rules-cli"
|
||||||
|
cursor_rules_cli_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
|
target_rules_json = cursor_rules_cli_dir / "rules.json"
|
||||||
|
|
||||||
|
try:
|
||||||
|
shutil.copy2(rules_json_path, target_rules_json)
|
||||||
|
logger.info(f"Successfully copied rules.json to {target_rules_json}")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Failed to copy rules.json to cursor-rules-cli folder: {str(e)}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}")
|
logger.error(f"An error occurred: {str(e)}")
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
|
|||||||
Reference in New Issue
Block a user