mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-27 13:12:55 +08:00
rules.json
This commit is contained in:
@@ -9,7 +9,7 @@ This repository contains Cursor rule files (.mdc) that provide AI-powered best p
|
||||
├── rules-mdc/ # Comprehensive rule files in a flat structure
|
||||
├── cursor-rules-cli/ # Source code and configuration for rule generation
|
||||
│ ├── generate_mdc_files.py
|
||||
│ ├── libraries.json
|
||||
│ ├── rules.json
|
||||
│ ├── config.yaml
|
||||
│ └── ...
|
||||
└── logs/ # Log files from rule generation runs
|
||||
@@ -40,7 +40,7 @@ The script uses a configuration file (`config.yaml`) with the following structur
|
||||
```yaml
|
||||
paths:
|
||||
mdc_instructions: "mdc-instructions.txt"
|
||||
libraries_json: "libraries.json"
|
||||
rules_json: "rules.json"
|
||||
output_dir: "rules-mdc"
|
||||
exa_results_dir: "exa_results"
|
||||
|
||||
@@ -116,7 +116,7 @@ rules-mdc/
|
||||
|
||||
## Available Libraries
|
||||
|
||||
All currently supported libraries can be found in `libraries.json`. This file organizes libraries with tags for flexible categorization:
|
||||
All currently supported libraries can be found in `rules.json`. This file organizes libraries with tags for flexible categorization:
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
+600
@@ -0,0 +1,600 @@
|
||||
{
|
||||
"libraries": [
|
||||
{
|
||||
"name": "react",
|
||||
"tags": ["frontend", "framework", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "react-native",
|
||||
"tags": ["frontend", "framework", "javascript", "mobile", "cross-platform"]
|
||||
},
|
||||
{
|
||||
"name": "react-query",
|
||||
"tags": ["frontend", "javascript", "data-fetching"]
|
||||
},
|
||||
{
|
||||
"name": "react-redux",
|
||||
"tags": ["frontend", "javascript", "state-management"]
|
||||
},
|
||||
{
|
||||
"name": "react-mobx",
|
||||
"tags": ["frontend", "javascript", "state-management"]
|
||||
},
|
||||
{
|
||||
"name": "next.js",
|
||||
"tags": ["frontend", "framework", "javascript", "react", "ssr"]
|
||||
},
|
||||
{
|
||||
"name": "vue",
|
||||
"tags": ["frontend", "framework", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "vue3",
|
||||
"tags": ["frontend", "framework", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "nuxt",
|
||||
"tags": ["frontend", "framework", "javascript", "vue", "ssr"]
|
||||
},
|
||||
{
|
||||
"name": "angular",
|
||||
"tags": ["frontend", "framework", "javascript", "typescript"]
|
||||
},
|
||||
{
|
||||
"name": "svelte",
|
||||
"tags": ["frontend", "framework", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "sveltekit",
|
||||
"tags": ["frontend", "framework", "javascript", "svelte", "ssr"]
|
||||
},
|
||||
{
|
||||
"name": "solidjs",
|
||||
"tags": ["frontend", "framework", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "qwik",
|
||||
"tags": ["frontend", "framework", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "express",
|
||||
"tags": ["backend", "framework", "javascript", "nodejs"]
|
||||
},
|
||||
{
|
||||
"name": "nestjs",
|
||||
"tags": ["backend", "framework", "javascript", "typescript", "nodejs"]
|
||||
},
|
||||
{
|
||||
"name": "bun",
|
||||
"tags": ["backend", "javascript", "runtime", "nodejs-alternative"]
|
||||
},
|
||||
{
|
||||
"name": "django",
|
||||
"tags": ["backend", "framework", "python", "orm", "full-stack"]
|
||||
},
|
||||
{
|
||||
"name": "flask",
|
||||
"tags": ["backend", "framework", "python", "microframework"]
|
||||
},
|
||||
{
|
||||
"name": "fastapi",
|
||||
"tags": ["backend", "framework", "python", "api", "async"]
|
||||
},
|
||||
{
|
||||
"name": "pyramid",
|
||||
"tags": ["backend", "framework", "python"]
|
||||
},
|
||||
{
|
||||
"name": "tornado",
|
||||
"tags": ["backend", "framework", "python", "async"]
|
||||
},
|
||||
{
|
||||
"name": "sanic",
|
||||
"tags": ["backend", "framework", "python", "async"]
|
||||
},
|
||||
{
|
||||
"name": "bottle",
|
||||
"tags": ["backend", "framework", "python", "microframework"]
|
||||
},
|
||||
{
|
||||
"name": "laravel",
|
||||
"tags": ["backend", "framework", "php"]
|
||||
},
|
||||
{
|
||||
"name": "springboot",
|
||||
"tags": ["backend", "framework", "java"]
|
||||
},
|
||||
{
|
||||
"name": "fiber",
|
||||
"tags": ["backend", "framework", "go"]
|
||||
},
|
||||
{
|
||||
"name": "servemux",
|
||||
"tags": ["backend", "framework", "go"]
|
||||
},
|
||||
{
|
||||
"name": "phoenix",
|
||||
"tags": ["backend", "framework", "elixir"]
|
||||
},
|
||||
{
|
||||
"name": "actix-web",
|
||||
"tags": ["backend", "framework", "rust"]
|
||||
},
|
||||
{
|
||||
"name": "rocket",
|
||||
"tags": ["backend", "framework", "rust"]
|
||||
},
|
||||
{
|
||||
"name": "shadcn",
|
||||
"tags": ["ui", "component-library", "react"]
|
||||
},
|
||||
{
|
||||
"name": "chakra-ui",
|
||||
"tags": ["ui", "component-library", "react"]
|
||||
},
|
||||
{
|
||||
"name": "material-ui",
|
||||
"tags": ["ui", "component-library", "react"]
|
||||
},
|
||||
{
|
||||
"name": "tailwind",
|
||||
"tags": ["ui", "css", "utility-first"]
|
||||
},
|
||||
{
|
||||
"name": "jetpack-compose",
|
||||
"tags": ["ui", "mobile", "android", "kotlin"]
|
||||
},
|
||||
{
|
||||
"name": "tkinter",
|
||||
"tags": ["ui", "gui", "python", "desktop"]
|
||||
},
|
||||
{
|
||||
"name": "pyqt",
|
||||
"tags": ["ui", "gui", "python", "desktop", "qt"]
|
||||
},
|
||||
{
|
||||
"name": "pyside",
|
||||
"tags": ["ui", "gui", "python", "desktop", "qt"]
|
||||
},
|
||||
{
|
||||
"name": "kivy",
|
||||
"tags": ["ui", "gui", "python", "cross-platform", "mobile"]
|
||||
},
|
||||
{
|
||||
"name": "pygame",
|
||||
"tags": ["ui", "gui", "python", "game-development"]
|
||||
},
|
||||
{
|
||||
"name": "customtkinter",
|
||||
"tags": ["ui", "gui", "python", "desktop", "tkinter"]
|
||||
},
|
||||
{
|
||||
"name": "redux",
|
||||
"tags": ["state-management", "javascript", "react"]
|
||||
},
|
||||
{
|
||||
"name": "mobx",
|
||||
"tags": ["state-management", "javascript", "react"]
|
||||
},
|
||||
{
|
||||
"name": "zustand",
|
||||
"tags": ["state-management", "javascript", "react"]
|
||||
},
|
||||
{
|
||||
"name": "riverpod",
|
||||
"tags": ["state-management", "flutter", "dart"]
|
||||
},
|
||||
{
|
||||
"name": "supabase",
|
||||
"tags": ["database", "sql", "postgresql", "backend-as-service"]
|
||||
},
|
||||
{
|
||||
"name": "postgresql",
|
||||
"tags": ["database", "sql", "relational"]
|
||||
},
|
||||
{
|
||||
"name": "prisma",
|
||||
"tags": ["database", "orm", "typescript", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "mongodb",
|
||||
"tags": ["database", "nosql", "document"]
|
||||
},
|
||||
{
|
||||
"name": "redis",
|
||||
"tags": ["database", "nosql", "key-value", "in-memory"]
|
||||
},
|
||||
{
|
||||
"name": "duckdb",
|
||||
"tags": ["database", "analytics", "sql", "olap"]
|
||||
},
|
||||
{
|
||||
"name": "sqlalchemy",
|
||||
"tags": ["database", "orm", "python", "sql"]
|
||||
},
|
||||
{
|
||||
"name": "peewee",
|
||||
"tags": ["database", "orm", "python", "sql"]
|
||||
},
|
||||
{
|
||||
"name": "pony",
|
||||
"tags": ["database", "orm", "python", "sql"]
|
||||
},
|
||||
{
|
||||
"name": "tortoise-orm",
|
||||
"tags": ["database", "orm", "python", "sql", "async"]
|
||||
},
|
||||
{
|
||||
"name": "django-orm",
|
||||
"tags": ["database", "orm", "python", "sql", "django"]
|
||||
},
|
||||
{
|
||||
"name": "vite",
|
||||
"tags": ["development", "build-tool", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "webpack",
|
||||
"tags": ["development", "build-tool", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "turbopack",
|
||||
"tags": ["development", "build-tool", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "poetry",
|
||||
"tags": ["development", "build-tool", "python", "dependency-management"]
|
||||
},
|
||||
{
|
||||
"name": "setuptools",
|
||||
"tags": ["development", "build-tool", "python", "packaging"]
|
||||
},
|
||||
{
|
||||
"name": "jest",
|
||||
"tags": ["development", "testing", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "detox",
|
||||
"tags": ["development", "testing", "javascript", "react-native", "e2e"]
|
||||
},
|
||||
{
|
||||
"name": "playwright",
|
||||
"tags": ["development", "testing", "javascript", "e2e", "browser"]
|
||||
},
|
||||
{
|
||||
"name": "vitest",
|
||||
"tags": ["development", "testing", "javascript", "vite"]
|
||||
},
|
||||
{
|
||||
"name": "pytest",
|
||||
"tags": ["development", "testing", "python"]
|
||||
},
|
||||
{
|
||||
"name": "unittest",
|
||||
"tags": ["development", "testing", "python", "standard-library"]
|
||||
},
|
||||
{
|
||||
"name": "nose2",
|
||||
"tags": ["development", "testing", "python"]
|
||||
},
|
||||
{
|
||||
"name": "hypothesis",
|
||||
"tags": ["development", "testing", "python", "property-based"]
|
||||
},
|
||||
{
|
||||
"name": "behave",
|
||||
"tags": ["development", "testing", "python", "bdd"]
|
||||
},
|
||||
{
|
||||
"name": "docker",
|
||||
"tags": ["development", "containerization", "devops"]
|
||||
},
|
||||
{
|
||||
"name": "kubernetes",
|
||||
"tags": ["development", "containerization", "orchestration", "devops"]
|
||||
},
|
||||
{
|
||||
"name": "git",
|
||||
"tags": ["development", "version-control"]
|
||||
},
|
||||
{
|
||||
"name": "mkdocs",
|
||||
"tags": ["development", "documentation", "markdown"]
|
||||
},
|
||||
{
|
||||
"name": "sphinx",
|
||||
"tags": ["development", "documentation", "python", "rst"]
|
||||
},
|
||||
{
|
||||
"name": "pdoc",
|
||||
"tags": ["development", "documentation", "python", "auto-generation"]
|
||||
},
|
||||
{
|
||||
"name": "github-actions",
|
||||
"tags": ["development", "ci-cd", "devops"]
|
||||
},
|
||||
{
|
||||
"name": "terraform",
|
||||
"tags": ["development", "infrastructure", "iac", "devops"]
|
||||
},
|
||||
{
|
||||
"name": "black",
|
||||
"tags": ["development", "python", "formatter", "linting"]
|
||||
},
|
||||
{
|
||||
"name": "flake8",
|
||||
"tags": ["development", "python", "linting"]
|
||||
},
|
||||
{
|
||||
"name": "pylint",
|
||||
"tags": ["development", "python", "linting", "static-analysis"]
|
||||
},
|
||||
{
|
||||
"name": "mypy",
|
||||
"tags": ["development", "python", "type-checking", "static-analysis"]
|
||||
},
|
||||
{
|
||||
"name": "isort",
|
||||
"tags": ["development", "python", "formatter", "imports"]
|
||||
},
|
||||
{
|
||||
"name": "pydantic",
|
||||
"tags": ["development", "python", "data-validation", "type-checking"]
|
||||
},
|
||||
{
|
||||
"name": "pyright",
|
||||
"tags": ["development", "python", "type-checking", "static-analysis"]
|
||||
},
|
||||
{
|
||||
"name": "tauri",
|
||||
"tags": ["cross-platform", "desktop", "rust", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "electron",
|
||||
"tags": ["cross-platform", "desktop", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "expo",
|
||||
"tags": ["cross-platform", "mobile", "react-native"]
|
||||
},
|
||||
{
|
||||
"name": "flutter",
|
||||
"tags": ["cross-platform", "mobile", "dart"]
|
||||
},
|
||||
{
|
||||
"name": "pytorch",
|
||||
"tags": ["ai", "ml", "machine-learning", "python", "deep-learning"]
|
||||
},
|
||||
{
|
||||
"name": "scikit-learn",
|
||||
"tags": ["ai", "ml", "machine-learning", "python", "data-science"]
|
||||
},
|
||||
{
|
||||
"name": "pandas",
|
||||
"tags": ["ai", "ml", "data-science", "python", "data-analysis"]
|
||||
},
|
||||
{
|
||||
"name": "tensorflow",
|
||||
"tags": ["ai", "ml", "machine-learning", "python", "deep-learning"]
|
||||
},
|
||||
{
|
||||
"name": "keras",
|
||||
"tags": ["ai", "ml", "machine-learning", "python", "deep-learning"]
|
||||
},
|
||||
{
|
||||
"name": "xgboost",
|
||||
"tags": ["ai", "ml", "machine-learning", "python", "gradient-boosting"]
|
||||
},
|
||||
{
|
||||
"name": "lightgbm",
|
||||
"tags": ["ai", "ml", "machine-learning", "python", "gradient-boosting"]
|
||||
},
|
||||
{
|
||||
"name": "cuda",
|
||||
"tags": ["ai", "ml", "gpu-computing", "parallel-computing"]
|
||||
},
|
||||
{
|
||||
"name": "numba",
|
||||
"tags": ["ai", "ml", "gpu-computing", "python", "jit-compiler"]
|
||||
},
|
||||
{
|
||||
"name": "langchain",
|
||||
"tags": ["ai", "ml", "llm", "python"]
|
||||
},
|
||||
{
|
||||
"name": "huggingface",
|
||||
"tags": ["ai", "ml", "llm", "python", "transformers"]
|
||||
},
|
||||
{
|
||||
"name": "vllm",
|
||||
"tags": ["ai", "ml", "llm", "python", "inference"]
|
||||
},
|
||||
{
|
||||
"name": "llama-index",
|
||||
"tags": ["ai", "ml", "llm", "python", "rag"]
|
||||
},
|
||||
{
|
||||
"name": "modal",
|
||||
"tags": ["ai", "ml", "cloud-inference", "serverless", "deployment"]
|
||||
},
|
||||
{
|
||||
"name": "numpy",
|
||||
"tags": ["ai", "ml", "data-science", "python", "numerical-computing"]
|
||||
},
|
||||
{
|
||||
"name": "scipy",
|
||||
"tags": ["ai", "ml", "data-science", "python", "scientific-computing"]
|
||||
},
|
||||
{
|
||||
"name": "matplotlib",
|
||||
"tags": ["ai", "ml", "data-science", "python", "data-visualization"]
|
||||
},
|
||||
{
|
||||
"name": "seaborn",
|
||||
"tags": ["ai", "ml", "data-science", "python", "data-visualization"]
|
||||
},
|
||||
{
|
||||
"name": "plotly",
|
||||
"tags": ["ai", "ml", "data-science", "python", "interactive-visualization"]
|
||||
},
|
||||
{
|
||||
"name": "statsmodels",
|
||||
"tags": ["ai", "ml", "data-science", "python", "statistics"]
|
||||
},
|
||||
{
|
||||
"name": "dask",
|
||||
"tags": ["ai", "ml", "data-science", "python", "parallel-computing", "big-data"]
|
||||
},
|
||||
{
|
||||
"name": "htmx",
|
||||
"tags": ["web", "javascript", "modern-patterns"]
|
||||
},
|
||||
{
|
||||
"name": "trpc",
|
||||
"tags": ["web", "typescript", "api", "modern-patterns"]
|
||||
},
|
||||
{
|
||||
"name": "typescript",
|
||||
"tags": ["web", "javascript", "type-checking", "language"]
|
||||
},
|
||||
{
|
||||
"name": "zod",
|
||||
"tags": ["web", "typescript", "validation", "type-checking"]
|
||||
},
|
||||
{
|
||||
"name": "axios",
|
||||
"tags": ["web", "javascript", "http-client"]
|
||||
},
|
||||
{
|
||||
"name": "guzzle",
|
||||
"tags": ["web", "php", "http-client"]
|
||||
},
|
||||
{
|
||||
"name": "requests",
|
||||
"tags": ["web", "python", "http-client"]
|
||||
},
|
||||
{
|
||||
"name": "httpx",
|
||||
"tags": ["web", "python", "http-client", "async"]
|
||||
},
|
||||
{
|
||||
"name": "aiohttp",
|
||||
"tags": ["web", "python", "http-client", "async"]
|
||||
},
|
||||
{
|
||||
"name": "graphql",
|
||||
"tags": ["web", "api", "query-language"]
|
||||
},
|
||||
{
|
||||
"name": "apollo-client",
|
||||
"tags": ["web", "api", "graphql", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "flask-restful",
|
||||
"tags": ["web", "api", "python", "flask"]
|
||||
},
|
||||
{
|
||||
"name": "solidity",
|
||||
"tags": ["blockchain", "ethereum", "smart-contracts", "language"]
|
||||
},
|
||||
{
|
||||
"name": "hardhat",
|
||||
"tags": ["blockchain", "ethereum", "development", "javascript"]
|
||||
},
|
||||
{
|
||||
"name": "vercel",
|
||||
"tags": ["cloud", "deployment", "serverless", "frontend"]
|
||||
},
|
||||
{
|
||||
"name": "cloudflare",
|
||||
"tags": ["cloud", "deployment", "edge-computing", "cdn"]
|
||||
},
|
||||
{
|
||||
"name": "aws-lambda",
|
||||
"tags": ["cloud", "serverless", "aws"]
|
||||
},
|
||||
{
|
||||
"name": "aws",
|
||||
"tags": ["cloud", "major-platform"]
|
||||
},
|
||||
{
|
||||
"name": "gcp",
|
||||
"tags": ["cloud", "major-platform"]
|
||||
},
|
||||
{
|
||||
"name": "azure",
|
||||
"tags": ["cloud", "major-platform"]
|
||||
},
|
||||
{
|
||||
"name": "beautifulsoup4",
|
||||
"tags": ["python", "web-scraping", "html-parsing"]
|
||||
},
|
||||
{
|
||||
"name": "scrapy",
|
||||
"tags": ["python", "web-scraping", "crawler", "framework"]
|
||||
},
|
||||
{
|
||||
"name": "selenium",
|
||||
"tags": ["python", "web-scraping", "browser-automation", "testing"]
|
||||
},
|
||||
{
|
||||
"name": "asyncio",
|
||||
"tags": ["python", "async", "standard-library"]
|
||||
},
|
||||
{
|
||||
"name": "trio",
|
||||
"tags": ["python", "async"]
|
||||
},
|
||||
{
|
||||
"name": "anyio",
|
||||
"tags": ["python", "async", "compatibility-layer"]
|
||||
},
|
||||
{
|
||||
"name": "nltk",
|
||||
"tags": ["python", "nlp", "text-processing"]
|
||||
},
|
||||
{
|
||||
"name": "spacy",
|
||||
"tags": ["python", "nlp", "text-processing"]
|
||||
},
|
||||
{
|
||||
"name": "gensim",
|
||||
"tags": ["python", "nlp", "topic-modeling"]
|
||||
},
|
||||
{
|
||||
"name": "transformers",
|
||||
"tags": ["python", "nlp", "deep-learning", "huggingface"]
|
||||
},
|
||||
{
|
||||
"name": "pillow",
|
||||
"tags": ["python", "image-processing"]
|
||||
},
|
||||
{
|
||||
"name": "opencv-python",
|
||||
"tags": ["python", "image-processing", "computer-vision"]
|
||||
},
|
||||
{
|
||||
"name": "scikit-image",
|
||||
"tags": ["python", "image-processing", "scientific-computing"]
|
||||
},
|
||||
{
|
||||
"name": "tqdm",
|
||||
"tags": ["python", "utilities", "progress-bar"]
|
||||
},
|
||||
{
|
||||
"name": "rich",
|
||||
"tags": ["python", "utilities", "terminal", "formatting"]
|
||||
},
|
||||
{
|
||||
"name": "click",
|
||||
"tags": ["python", "utilities", "cli"]
|
||||
},
|
||||
{
|
||||
"name": "typer",
|
||||
"tags": ["python", "utilities", "cli"]
|
||||
},
|
||||
{
|
||||
"name": "streamlit",
|
||||
"tags": ["python", "utilities", "data-apps", "dashboard"]
|
||||
}
|
||||
]
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
paths:
|
||||
mdc_instructions: "mdc-instructions.txt"
|
||||
libraries_json: "libraries.json"
|
||||
rules_json: "rules.json"
|
||||
output_dir: "rules-mdc"
|
||||
|
||||
api:
|
||||
|
||||
+28
-30
@@ -48,7 +48,7 @@ load_dotenv()
|
||||
DEFAULT_CONFIG = {
|
||||
"paths": {
|
||||
"mdc_instructions": "mdc-instructions.txt",
|
||||
"libraries_json": "libraries.json",
|
||||
"rules_json": "rules.json",
|
||||
"output_dir": "rules-mdc",
|
||||
"exa_results_dir": "exa_results" # Directory to store Exa results
|
||||
},
|
||||
@@ -527,21 +527,21 @@ def process_single_library(library_info: Dict[str, Any], output_dir: str, exa_cl
|
||||
logger.error(f"Error processing library {library_name}: {str(e)}")
|
||||
return (library_key, False)
|
||||
|
||||
def process_libraries_json(json_path: str, output_dir: str, test_mode: bool = False,
|
||||
target_tag: str = None, target_library: str = None) -> None:
|
||||
"""Process libraries.json and generate MDC files."""
|
||||
# Check if libraries.json exists
|
||||
if not Path(json_path).exists():
|
||||
logger.error(f"Libraries JSON file not found at {json_path}")
|
||||
def process_rules_json(json_path: str, output_dir: str, test_mode: bool = False,
|
||||
specific_library: Optional[str] = None, specific_tag: Optional[str] = None):
|
||||
"""Process rules.json and generate MDC files."""
|
||||
# Check if rules.json exists
|
||||
if not os.path.exists(json_path):
|
||||
logger.error(f"Rules JSON file not found at {json_path}")
|
||||
return
|
||||
|
||||
# Load libraries.json
|
||||
# Load rules.json
|
||||
with open(json_path, 'r') as f:
|
||||
libraries_data = json.load(f)
|
||||
|
||||
# Check if the new flat structure is used
|
||||
if "libraries" not in libraries_data:
|
||||
logger.error("The libraries.json file does not use the expected flat structure with tags.")
|
||||
logger.error("The rules.json file does not use the expected flat structure with tags.")
|
||||
return
|
||||
|
||||
# Create progress tracker
|
||||
@@ -561,19 +561,17 @@ def process_libraries_json(json_path: str, output_dir: str, test_mode: bool = Fa
|
||||
libraries = libraries_data["libraries"]
|
||||
|
||||
# Filter libraries based on target tag or library if specified
|
||||
if target_tag or target_library:
|
||||
filtered_libraries = []
|
||||
for lib in libraries:
|
||||
if target_library and lib["name"] == target_library:
|
||||
filtered_libraries.append(lib)
|
||||
elif target_tag and target_tag in lib["tags"]:
|
||||
filtered_libraries.append(lib)
|
||||
libraries = filtered_libraries
|
||||
if specific_library:
|
||||
filtered_libraries = [lib for lib in libraries if lib["name"] == specific_library]
|
||||
elif specific_tag:
|
||||
filtered_libraries = [lib for lib in libraries if specific_tag in lib["tags"]]
|
||||
else:
|
||||
filtered_libraries = libraries
|
||||
|
||||
# If test mode is enabled, just process one library
|
||||
if test_mode:
|
||||
if libraries:
|
||||
test_library = libraries[0]
|
||||
if filtered_libraries:
|
||||
test_library = filtered_libraries[0]
|
||||
library_key, success = process_single_library(test_library, output_dir, exa_client)
|
||||
if success:
|
||||
progress_tracker.mark_library_completed(library_key)
|
||||
@@ -586,7 +584,7 @@ def process_libraries_json(json_path: str, output_dir: str, test_mode: bool = Fa
|
||||
# Prepare list of libraries to process
|
||||
libraries_to_process = []
|
||||
|
||||
for library in libraries:
|
||||
for library in filtered_libraries:
|
||||
# Create a unique key for this library
|
||||
library_key = library["name"]
|
||||
|
||||
@@ -628,7 +626,7 @@ def process_libraries_json(json_path: str, output_dir: str, test_mode: bool = Fa
|
||||
def main():
|
||||
"""Main function to run the MDC generation process."""
|
||||
# Parse command line arguments
|
||||
parser = argparse.ArgumentParser(description="Generate MDC files from libraries.json")
|
||||
parser = argparse.ArgumentParser(description="Generate MDC files from rules.json")
|
||||
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("--library", type=str, help="Process only a specific library")
|
||||
@@ -656,12 +654,12 @@ def main():
|
||||
CONFIG["paths"]["exa_results_dir"] = args.exa_results_dir
|
||||
|
||||
# Set paths
|
||||
libraries_json_path = CONFIG["paths"]["libraries_json"]
|
||||
rules_json_path = CONFIG["paths"]["rules_json"]
|
||||
output_dir = args.output or CONFIG["paths"]["output_dir"]
|
||||
|
||||
# Check if libraries.json exists
|
||||
if not os.path.exists(libraries_json_path):
|
||||
logger.error(f"libraries.json not found at {libraries_json_path}")
|
||||
# Check if rules.json exists
|
||||
if not os.path.exists(rules_json_path):
|
||||
logger.error(f"rules.json not found at {rules_json_path}")
|
||||
return
|
||||
|
||||
# Check if EXA_API_KEY is set
|
||||
@@ -669,13 +667,13 @@ def main():
|
||||
logger.warning("EXA_API_KEY environment variable not set. Will generate content using LLM only.")
|
||||
|
||||
try:
|
||||
# Process libraries.json and generate MDC files
|
||||
process_libraries_json(
|
||||
libraries_json_path,
|
||||
# Process rules.json and generate MDC files
|
||||
process_rules_json(
|
||||
rules_json_path,
|
||||
output_dir,
|
||||
test_mode=args.test,
|
||||
target_tag=args.tag,
|
||||
target_library=args.library
|
||||
specific_library=args.library,
|
||||
specific_tag=args.tag
|
||||
)
|
||||
logger.info("MDC generation completed successfully!")
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user