mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-30 23:04:59 +08:00
Migrate to flat library structure with tag-based organization
Update project to use a new, more flexible library organization approach: - Replace nested category/subcategory structure with a flat JSON format - Introduce tag-based library classification - Update generate_mdc_files.py to support new library structure - Modify README to reflect new organization - Update progress tracking and library processing logic Simplify library management and improve categorization flexibility by using a more dynamic tagging system
This commit is contained in:
@@ -1,25 +1,25 @@
|
|||||||
# MDC Generator for Library Best Practices
|
# MDC Generator for Library Best Practices
|
||||||
|
|
||||||
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 the current, improved version which are more focused and comprehensive. (Note: The `rules-v0/` directory contains legacy rules and is kept for historical reference only - please use `rules-mdc/` for all new projects).
|
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.
|
||||||
|
|
||||||
## Repository Structure
|
## Repository Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
.
|
.
|
||||||
├── rules-mdc/ # Current, comprehensive rule files (recommended)
|
├── rules-mdc/ # Comprehensive rule files in a flat structure
|
||||||
│ ├── frontend/
|
├── cursor-rules-cli/ # Source code and configuration for rule generation
|
||||||
│ ├── backend/
|
|
||||||
│ └── ...
|
|
||||||
├── src/ # Source code for rule generation
|
|
||||||
│ ├── generate_mdc_files.py
|
│ ├── generate_mdc_files.py
|
||||||
|
│ ├── libraries.json
|
||||||
│ ├── config.yaml
|
│ ├── config.yaml
|
||||||
│ └── ...
|
│ └── ...
|
||||||
└── rules-v0/ # Legacy rules (deprecated)
|
└── logs/ # Log files from rule generation runs
|
||||||
```
|
```
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Configurable**: All settings can be adjusted in `src/config.yaml`
|
- **Tag-Based Library Organization**: Libraries are organized with tags instead of nested categories for more flexible categorization
|
||||||
|
- **Flat Directory Structure**: All MDC files are stored in a single directory for easier access
|
||||||
|
- **Configurable**: All settings can be adjusted in `config.yaml`
|
||||||
- **Parallel Processing**: Process multiple libraries simultaneously
|
- **Parallel Processing**: Process multiple libraries simultaneously
|
||||||
- **Progress Tracking**: Resume from where you left off if the process is interrupted
|
- **Progress Tracking**: Resume from where you left off if the process is interrupted
|
||||||
- **Smart Glob Pattern Generation**: Automatically determines appropriate glob patterns for different libraries
|
- **Smart Glob Pattern Generation**: Automatically determines appropriate glob patterns for different libraries
|
||||||
@@ -35,17 +35,18 @@ This repository contains Cursor rule files (.mdc) that provide AI-powered best p
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The script uses a configuration file (`src/config.yaml`) with the following structure:
|
The script uses a configuration file (`config.yaml`) with the following structure:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
paths:
|
paths:
|
||||||
mdc_instructions: "mdc-instructions.txt"
|
mdc_instructions: "mdc-instructions.txt"
|
||||||
libraries_json: "libraries.json"
|
libraries_json: "libraries.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"
|
||||||
rate_limit_calls: 100
|
rate_limit_calls: 2000
|
||||||
rate_limit_period: 60
|
rate_limit_period: 60
|
||||||
max_retries: 3
|
max_retries: 3
|
||||||
retry_min_wait: 4
|
retry_min_wait: 4
|
||||||
@@ -53,7 +54,11 @@ api:
|
|||||||
|
|
||||||
processing:
|
processing:
|
||||||
max_workers: 4
|
max_workers: 4
|
||||||
chunk_size: 25000
|
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
|
||||||
@@ -61,80 +66,85 @@ processing:
|
|||||||
### Basic Usage
|
### Basic Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run src/generate_mdc_files.py
|
uv run generate_mdc_files.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Test Mode (Process Only One Library)
|
### Test Mode (Process Only One Library)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run src/generate_mdc_files.py --test
|
uv run generate_mdc_files.py --test
|
||||||
```
|
```
|
||||||
|
|
||||||
### Process Specific Categories or Libraries
|
### Process Specific Tags or Libraries
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run src/generate_mdc_files.py --category frontend_frameworks
|
uv run generate_mdc_files.py --tag python
|
||||||
uv run src/generate_mdc_files.py --subcategory react
|
uv run generate_mdc_files.py --library react
|
||||||
uv run src/generate_mdc_files.py --library react
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Adjust Parallel Processing
|
### Adjust Parallel Processing
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run src/generate_mdc_files.py --workers 8
|
uv run generate_mdc_files.py --workers 8
|
||||||
```
|
```
|
||||||
|
|
||||||
### Adjust Rate Limits
|
### Adjust Rate Limits
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run src/generate_mdc_files.py --rate-limit 50
|
uv run generate_mdc_files.py --rate-limit 50
|
||||||
```
|
```
|
||||||
|
|
||||||
### Verbose Logging
|
### Verbose Logging
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run src/generate_mdc_files.py --verbose
|
uv run generate_mdc_files.py --verbose
|
||||||
```
|
```
|
||||||
|
|
||||||
## File Structure
|
## File Structure
|
||||||
|
|
||||||
The generated MDC files will be organized in the following structure:
|
The generated MDC files are organized in a flat structure:
|
||||||
|
|
||||||
```
|
```
|
||||||
rules-mdc/
|
rules-mdc/
|
||||||
├── frontend/
|
├── react.mdc
|
||||||
│ ├── react/
|
├── vue.mdc
|
||||||
│ │ ├── react.mdc
|
├── django.mdc
|
||||||
│ │ ├── react-native.mdc
|
├── flask.mdc
|
||||||
│ │ └── ...
|
├── pytest.mdc
|
||||||
│ ├── vue/
|
|
||||||
│ │ └── ...
|
|
||||||
│ └── ...
|
|
||||||
├── backend/
|
|
||||||
│ ├── python/
|
|
||||||
│ │ ├── django.mdc
|
|
||||||
│ │ ├── flask.mdc
|
|
||||||
│ │ └── ...
|
|
||||||
│ └── ...
|
|
||||||
└── ...
|
└── ...
|
||||||
```
|
```
|
||||||
|
|
||||||
## Available Libraries
|
## Available Libraries
|
||||||
|
|
||||||
All currently supported libraries and their categories can be found in `src/libraries.json`. This file organizes libraries into categories like:
|
All currently supported libraries can be found in `libraries.json`. This file organizes libraries with tags for flexible categorization:
|
||||||
- Frontend Frameworks (React, Vue, Angular, etc.)
|
|
||||||
- Backend Frameworks (Node.js, Python, PHP, etc.)
|
|
||||||
- UI Libraries
|
|
||||||
- State Management
|
|
||||||
- Database Tools
|
|
||||||
- Development Tools
|
|
||||||
- Cross Platform
|
|
||||||
- AI/ML
|
|
||||||
- Web Technologies
|
|
||||||
- Blockchain
|
|
||||||
- Cloud Platforms
|
|
||||||
|
|
||||||
Each category contains relevant subcategories and specific libraries. Check `src/libraries.json` for the complete, up-to-date list of supported libraries.
|
```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
|
## Progress Tracking
|
||||||
|
|
||||||
|
|||||||
+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"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
"next-js": "completed",
|
||||||
|
"langchain": "completed",
|
||||||
|
"cuda": "completed",
|
||||||
|
"react-native": "completed",
|
||||||
|
"zod": "completed",
|
||||||
|
"vue": "completed",
|
||||||
|
"cloudflare": "completed",
|
||||||
|
"webpack": "completed",
|
||||||
|
"expo": "completed",
|
||||||
|
"supabase": "completed",
|
||||||
|
"gcp": "completed",
|
||||||
|
"vitest": "completed",
|
||||||
|
"express": "completed",
|
||||||
|
"aws": "completed",
|
||||||
|
"nuxt": "completed",
|
||||||
|
"solidity": "completed",
|
||||||
|
"huggingface": "completed",
|
||||||
|
"tailwind": "completed",
|
||||||
|
"flutter": "completed",
|
||||||
|
"pandas": "completed",
|
||||||
|
"angular": "completed",
|
||||||
|
"git": "completed",
|
||||||
|
"docker": "completed",
|
||||||
|
"chakra-ui": "completed",
|
||||||
|
"kubernetes": "completed",
|
||||||
|
"shadcn": "completed",
|
||||||
|
"tensorflow": "completed",
|
||||||
|
"react-redux": "completed",
|
||||||
|
"react-query": "completed",
|
||||||
|
"turbopack": "completed",
|
||||||
|
"material-ui": "completed",
|
||||||
|
"axios": "completed",
|
||||||
|
"bun": "completed",
|
||||||
|
"flask": "completed",
|
||||||
|
"sveltekit": "completed",
|
||||||
|
"vite": "completed",
|
||||||
|
"terraform": "completed",
|
||||||
|
"fastapi": "completed",
|
||||||
|
"modal": "completed",
|
||||||
|
"electron": "completed",
|
||||||
|
"detox": "completed",
|
||||||
|
"solidjs": "completed",
|
||||||
|
"riverpod": "completed",
|
||||||
|
"zustand": "completed",
|
||||||
|
"playwright": "completed",
|
||||||
|
"mongodb": "completed",
|
||||||
|
"svelte": "completed",
|
||||||
|
"mkdocs": "completed",
|
||||||
|
"laravel": "completed",
|
||||||
|
"vue3": "completed",
|
||||||
|
"vercel": "completed",
|
||||||
|
"typescript": "completed",
|
||||||
|
"github-actions": "completed",
|
||||||
|
"guzzle": "completed",
|
||||||
|
"servemux": "completed",
|
||||||
|
"css": "completed",
|
||||||
|
"jest": "completed",
|
||||||
|
"nestjs": "completed",
|
||||||
|
"pytorch": "completed",
|
||||||
|
"apollo-client": "completed",
|
||||||
|
"aws-lambda": "completed",
|
||||||
|
"qwik": "completed",
|
||||||
|
"azure": "completed",
|
||||||
|
"redux": "completed",
|
||||||
|
"htmx": "completed",
|
||||||
|
"mobx": "completed",
|
||||||
|
"fiber": "completed",
|
||||||
|
"hardhat": "completed",
|
||||||
|
"redis": "completed",
|
||||||
|
"react": "completed",
|
||||||
|
"react-mobx": "completed",
|
||||||
|
"graphql": "completed",
|
||||||
|
"springboot": "completed",
|
||||||
|
"jetpack-compose": "completed",
|
||||||
|
"django": "completed",
|
||||||
|
"rocket": "completed",
|
||||||
|
"tauri": "completed",
|
||||||
|
"scikit-learn": "completed",
|
||||||
|
"actix-web": "completed",
|
||||||
|
"trpc": "completed",
|
||||||
|
"postgresql": "completed",
|
||||||
|
"duckdb": "completed",
|
||||||
|
"prisma": "completed",
|
||||||
|
"vllm": "completed"
|
||||||
|
}
|
||||||
+124
-87
@@ -50,7 +50,7 @@ DEFAULT_CONFIG = {
|
|||||||
"mdc_instructions": "mdc-instructions.txt",
|
"mdc_instructions": "mdc-instructions.txt",
|
||||||
"libraries_json": "libraries.json",
|
"libraries_json": "libraries.json",
|
||||||
"output_dir": "rules-mdc",
|
"output_dir": "rules-mdc",
|
||||||
"exa_results_dir": "exa_results" # New directory to store Exa results
|
"exa_results_dir": "exa_results" # Directory to store Exa results
|
||||||
},
|
},
|
||||||
"api": {
|
"api": {
|
||||||
"llm_model": "gemini/gemini-2.0-flash",
|
"llm_model": "gemini/gemini-2.0-flash",
|
||||||
@@ -108,9 +108,8 @@ class MDCRule(BaseModel):
|
|||||||
|
|
||||||
class LibraryInfo(BaseModel):
|
class LibraryInfo(BaseModel):
|
||||||
"""Model for library information."""
|
"""Model for library information."""
|
||||||
category: str
|
|
||||||
subcategory: str
|
|
||||||
name: str
|
name: str
|
||||||
|
tags: List[str]
|
||||||
best_practices: str = ""
|
best_practices: str = ""
|
||||||
citations: List[Dict[str, Any]] = []
|
citations: List[Dict[str, Any]] = []
|
||||||
|
|
||||||
@@ -185,9 +184,6 @@ def get_library_best_practices_exa(library_name: str, exa_client: Optional[Exa]
|
|||||||
"citations": result.citations if hasattr(result, 'citations') else []
|
"citations": result.citations if hasattr(result, 'citations') else []
|
||||||
}
|
}
|
||||||
|
|
||||||
# Log the full Exa result
|
|
||||||
# logger.info(f"Exa result for {library_name}: {result_dict}")
|
|
||||||
|
|
||||||
# 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 = Path(CONFIG["paths"]["exa_results_dir"])
|
||||||
exa_results_dir.mkdir(parents=True, exist_ok=True)
|
exa_results_dir.mkdir(parents=True, exist_ok=True)
|
||||||
@@ -213,6 +209,50 @@ 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"]),
|
||||||
@@ -247,6 +287,12 @@ 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
|
||||||
|
suggested_glob = determine_glob_pattern(library_info.name, library_info.tags)
|
||||||
|
|
||||||
|
# Format tags for prompt
|
||||||
|
tags_str = ", ".join(library_info.tags)
|
||||||
|
|
||||||
# Enhanced prompt template for both cases
|
# Enhanced prompt template for both cases
|
||||||
enhanced_prompt_template = """Create a comprehensive Cursor rule file (.mdc) for the {library_name} library following these guidelines:
|
enhanced_prompt_template = """Create a comprehensive Cursor rule file (.mdc) for the {library_name} library following these guidelines:
|
||||||
|
|
||||||
@@ -254,8 +300,8 @@ def generate_mdc_rules_from_exa(library_info: LibraryInfo, exa_results: Dict[str
|
|||||||
|
|
||||||
Library Information:
|
Library Information:
|
||||||
- Name: {library_name}
|
- Name: {library_name}
|
||||||
- Category: {library_category}
|
- Tags: {tags}
|
||||||
- Subcategory: {library_subcategory}
|
- Suggested glob pattern: {suggested_glob}
|
||||||
|
|
||||||
{exa_content_section}
|
{exa_content_section}
|
||||||
|
|
||||||
@@ -312,7 +358,7 @@ Your task is to create an EXTREMELY DETAILED and COMPREHENSIVE guide that covers
|
|||||||
|
|
||||||
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
|
- 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)
|
||||||
- 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
|
||||||
"""
|
"""
|
||||||
@@ -328,8 +374,8 @@ 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,
|
||||||
library_category=library_info.category,
|
tags=tags_str,
|
||||||
library_subcategory=library_info.subcategory,
|
suggested_glob=suggested_glob,
|
||||||
exa_content_section=exa_content_section,
|
exa_content_section=exa_content_section,
|
||||||
mdc_instructions=mdc_instructions
|
mdc_instructions=mdc_instructions
|
||||||
)
|
)
|
||||||
@@ -350,8 +396,8 @@ 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,
|
||||||
library_category=library_info.category,
|
tags=tags_str,
|
||||||
library_subcategory=library_info.subcategory,
|
suggested_glob=suggested_glob,
|
||||||
exa_content_section=exa_content_section,
|
exa_content_section=exa_content_section,
|
||||||
mdc_instructions=mdc_instructions
|
mdc_instructions=mdc_instructions
|
||||||
)
|
)
|
||||||
@@ -429,62 +475,60 @@ globs: {rule.glob_pattern}
|
|||||||
f.write(mdc_content)
|
f.write(mdc_content)
|
||||||
logger.info(f"Created {output_path}")
|
logger.info(f"Created {output_path}")
|
||||||
|
|
||||||
def process_single_library(category: str, subcategory: str, library: str, output_dir: str, exa_client: Optional[Exa] = None) -> Tuple[str, bool]:
|
def process_single_library(library_info: Dict[str, Any], output_dir: str, exa_client: Optional[Exa] = None) -> Tuple[str, bool]:
|
||||||
"""Process a single library and generate MDC file. Returns (library_key, success)."""
|
"""Process a single library and generate MDC file. Returns (library_key, success)."""
|
||||||
library_key = f"{category}/{subcategory}/{library}"
|
library_name = library_info["name"]
|
||||||
logger.info(f"Processing library: {library} (Category: {category}, Subcategory: {subcategory})")
|
library_tags = library_info["tags"]
|
||||||
|
|
||||||
|
# Create a unique key for this library - using just the name for flat structure
|
||||||
|
library_key = library_name
|
||||||
|
|
||||||
|
logger.info(f"Processing library: {library_name} (Tags: {', '.join(library_tags)})")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create output directory structure
|
# Create output directory structure
|
||||||
output_path = Path(output_dir)
|
output_path = Path(output_dir)
|
||||||
category_dir = output_path / category
|
if not output_path.exists():
|
||||||
subcategory_dir = category_dir / subcategory
|
output_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Create directories if they don't exist
|
|
||||||
for directory in [output_path, category_dir, subcategory_dir]:
|
|
||||||
if not directory.exists():
|
|
||||||
directory.mkdir(exist_ok=True)
|
|
||||||
|
|
||||||
# Create library info object
|
# Create library info object
|
||||||
library_info = LibraryInfo(
|
library_obj = LibraryInfo(
|
||||||
category=category,
|
name=library_name,
|
||||||
subcategory=subcategory,
|
tags=library_tags
|
||||||
name=library
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get best practices using Exa
|
# Get best practices using Exa
|
||||||
logger.info(f"Getting best practices for {library} using Exa")
|
logger.info(f"Getting best practices for {library_name} using Exa")
|
||||||
exa_results = get_library_best_practices_exa(library, exa_client)
|
exa_results = get_library_best_practices_exa(library_name, exa_client)
|
||||||
|
|
||||||
# Store citations in library info
|
# Store citations in library info
|
||||||
library_info.citations = exa_results.get("citations", [])
|
library_obj.citations = exa_results.get("citations", [])
|
||||||
|
|
||||||
# Generate MDC rules directly from Exa results
|
# Generate MDC rules directly from Exa results
|
||||||
logger.info(f"Generating MDC rules for {library} directly from Exa results")
|
logger.info(f"Generating MDC rules for {library_name} directly from Exa results")
|
||||||
rules = generate_mdc_rules_from_exa(library_info, exa_results)
|
rules = generate_mdc_rules_from_exa(library_obj, exa_results)
|
||||||
|
|
||||||
# Save each rule to a file
|
# Save each rule to a file
|
||||||
for rule in rules:
|
for rule in rules:
|
||||||
# Create safe filename
|
# Create safe filename
|
||||||
safe_name = re.sub('[^a-z0-9-]+', '-', library.lower()).strip('-')
|
safe_name = re.sub('[^a-z0-9-]+', '-', library_name.lower()).strip('-')
|
||||||
mdc_filename = f"{safe_name}.mdc"
|
mdc_filename = f"{safe_name}.mdc"
|
||||||
|
|
||||||
# Determine output path
|
# Determine output path - directly in the output directory
|
||||||
output_file = subcategory_dir / mdc_filename
|
output_file = output_path / mdc_filename
|
||||||
|
|
||||||
# Create MDC file
|
# Create MDC file
|
||||||
create_mdc_file(rule, output_file)
|
create_mdc_file(rule, output_file)
|
||||||
|
|
||||||
logger.info(f"Successfully processed {library}")
|
logger.info(f"Successfully processed {library_name}")
|
||||||
return (library_key, True)
|
return (library_key, True)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error processing library {library}: {str(e)}")
|
logger.error(f"Error processing library {library_name}: {str(e)}")
|
||||||
return (library_key, False)
|
return (library_key, False)
|
||||||
|
|
||||||
def process_libraries_json(json_path: str, output_dir: str, test_mode: bool = False,
|
def process_libraries_json(json_path: str, output_dir: str, test_mode: bool = False,
|
||||||
target_category: str = None, target_subcategory: str = None,
|
target_tag: str = None, target_library: str = None) -> None:
|
||||||
target_library: str = None) -> None:
|
|
||||||
"""Process libraries.json and generate MDC files."""
|
"""Process libraries.json and generate MDC files."""
|
||||||
# Check if libraries.json exists
|
# Check if libraries.json exists
|
||||||
if not Path(json_path).exists():
|
if not Path(json_path).exists():
|
||||||
@@ -495,6 +539,11 @@ def process_libraries_json(json_path: str, output_dir: str, test_mode: bool = Fa
|
|||||||
with open(json_path, 'r') as f:
|
with open(json_path, 'r') as f:
|
||||||
libraries_data = json.load(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.")
|
||||||
|
return
|
||||||
|
|
||||||
# Create progress tracker
|
# Create progress tracker
|
||||||
progress_tracker = ProgressTracker()
|
progress_tracker = ProgressTracker()
|
||||||
|
|
||||||
@@ -508,56 +557,46 @@ def process_libraries_json(json_path: str, output_dir: str, test_mode: bool = Fa
|
|||||||
if not output_path.exists():
|
if not output_path.exists():
|
||||||
output_path.mkdir(parents=True, exist_ok=True)
|
output_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# Get libraries list
|
||||||
|
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 test mode is enabled, just process one library
|
# If test mode is enabled, just process one library
|
||||||
if test_mode:
|
if test_mode:
|
||||||
# Use React as the test library if no specific target is provided
|
if libraries:
|
||||||
test_category = target_category or "frontend_frameworks"
|
test_library = libraries[0]
|
||||||
test_subcategory = target_subcategory or "react"
|
library_key, success = process_single_library(test_library, output_dir, exa_client)
|
||||||
test_library = target_library or "react"
|
if success:
|
||||||
|
progress_tracker.mark_library_completed(library_key)
|
||||||
# Check if the test library exists in the JSON
|
|
||||||
if test_category in libraries_data and test_subcategory in libraries_data[test_category]:
|
|
||||||
if test_library in libraries_data[test_category][test_subcategory]:
|
|
||||||
library_key, success = process_single_library(test_category, test_subcategory, test_library, output_dir, exa_client)
|
|
||||||
if success:
|
|
||||||
progress_tracker.mark_library_completed(library_key)
|
|
||||||
else:
|
|
||||||
progress_tracker.mark_library_failed(library_key)
|
|
||||||
else:
|
else:
|
||||||
logger.error(f"Test library {test_library} not found in {test_category}/{test_subcategory}")
|
progress_tracker.mark_library_failed(library_key)
|
||||||
else:
|
else:
|
||||||
logger.error(f"Test category/subcategory {test_category}/{test_subcategory} not found")
|
logger.error("No libraries found to process in test mode")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# Prepare list of libraries to process
|
# Prepare list of libraries to process
|
||||||
libraries_to_process = []
|
libraries_to_process = []
|
||||||
|
|
||||||
for category, subcategories in libraries_data.items():
|
for library in libraries:
|
||||||
# Skip if a specific category is targeted and this isn't it
|
# Create a unique key for this library
|
||||||
if target_category and category != target_category:
|
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
|
continue
|
||||||
|
|
||||||
for subcategory, libraries in subcategories.items():
|
# Add to processing list
|
||||||
# Skip if a specific subcategory is targeted and this isn't it
|
libraries_to_process.append(library)
|
||||||
if target_subcategory and subcategory != target_subcategory:
|
|
||||||
continue
|
|
||||||
|
|
||||||
for library in libraries:
|
|
||||||
# Skip if a specific library is targeted and this isn't it
|
|
||||||
if target_library and library != target_library:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Create a unique key for this library
|
|
||||||
library_key = f"{category}/{subcategory}/{library}"
|
|
||||||
|
|
||||||
# Skip if already processed
|
|
||||||
if progress_tracker.is_library_processed(library_key):
|
|
||||||
logger.info(f"Skipping already processed library: {library}")
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Add to processing list
|
|
||||||
libraries_to_process.append((category, subcategory, library))
|
|
||||||
|
|
||||||
# Process libraries in parallel
|
# Process libraries in parallel
|
||||||
max_workers = CONFIG["processing"]["max_workers"]
|
max_workers = CONFIG["processing"]["max_workers"]
|
||||||
@@ -569,13 +608,13 @@ def process_libraries_json(json_path: str, output_dir: str, test_mode: bool = Fa
|
|||||||
|
|
||||||
# Submit all tasks
|
# Submit all tasks
|
||||||
future_to_library = {
|
future_to_library = {
|
||||||
executor.submit(process_func, category, subcategory, library): (category, subcategory, library)
|
executor.submit(process_func, library): library
|
||||||
for category, subcategory, library in libraries_to_process
|
for library in libraries_to_process
|
||||||
}
|
}
|
||||||
|
|
||||||
# Process results as they complete
|
# Process results as they complete
|
||||||
for future in concurrent.futures.as_completed(future_to_library):
|
for future in concurrent.futures.as_completed(future_to_library):
|
||||||
category, subcategory, library = future_to_library[future]
|
library = future_to_library[future]
|
||||||
try:
|
try:
|
||||||
library_key, success = future.result()
|
library_key, success = future.result()
|
||||||
if success:
|
if success:
|
||||||
@@ -583,16 +622,15 @@ def process_libraries_json(json_path: str, output_dir: str, test_mode: bool = Fa
|
|||||||
else:
|
else:
|
||||||
progress_tracker.mark_library_failed(library_key)
|
progress_tracker.mark_library_failed(library_key)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Exception processing {category}/{subcategory}/{library}: {str(e)}")
|
logger.error(f"Exception processing {library['name']}: {str(e)}")
|
||||||
progress_tracker.mark_library_failed(f"{category}/{subcategory}/{library}")
|
progress_tracker.mark_library_failed(library['name'])
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Main function to run the MDC generation process."""
|
"""Main function to run the MDC generation process."""
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
parser = argparse.ArgumentParser(description="Generate MDC files from libraries.json")
|
parser = argparse.ArgumentParser(description="Generate MDC files from libraries.json")
|
||||||
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("--category", type=str, help="Process only a specific category")
|
parser.add_argument("--tag", type=str, help="Process only libraries with a specific tag")
|
||||||
parser.add_argument("--subcategory", type=str, help="Process only a specific subcategory")
|
|
||||||
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=CONFIG["paths"]["output_dir"], 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")
|
||||||
@@ -636,8 +674,7 @@ def main():
|
|||||||
libraries_json_path,
|
libraries_json_path,
|
||||||
output_dir,
|
output_dir,
|
||||||
test_mode=args.test,
|
test_mode=args.test,
|
||||||
target_category=args.category,
|
target_tag=args.tag,
|
||||||
target_subcategory=args.subcategory,
|
|
||||||
target_library=args.library
|
target_library=args.library
|
||||||
)
|
)
|
||||||
logger.info("MDC generation completed successfully!")
|
logger.info("MDC generation completed successfully!")
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
{
|
|
||||||
"frontend_frameworks": {
|
|
||||||
"react": ["react", "react-native", "react-query", "react-redux", "react-mobx", "next.js"],
|
|
||||||
"vue": ["vue", "vue3", "nuxt"],
|
|
||||||
"angular": ["angular"],
|
|
||||||
"svelte": ["svelte", "sveltekit"],
|
|
||||||
"solid": ["solidjs"],
|
|
||||||
"qwik": ["qwik"]
|
|
||||||
},
|
|
||||||
"backend_frameworks": {
|
|
||||||
"nodejs": ["express", "nestjs", "bun"],
|
|
||||||
"python": ["django", "flask", "fastapi"],
|
|
||||||
"php": ["laravel"],
|
|
||||||
"java": ["springboot"],
|
|
||||||
"go": ["fiber", "servemux"],
|
|
||||||
"elixir": ["phoenix"],
|
|
||||||
"rust": ["actix-web", "rocket"]
|
|
||||||
},
|
|
||||||
"ui_libraries": {
|
|
||||||
"component_libraries": ["shadcn", "chakra-ui", "material-ui", "tailwind"],
|
|
||||||
"mobile_ui": ["jetpack-compose"]
|
|
||||||
},
|
|
||||||
"state_management": {
|
|
||||||
"react": ["redux", "mobx", "zustand"],
|
|
||||||
"flutter": ["riverpod"]
|
|
||||||
},
|
|
||||||
"database_tools": {
|
|
||||||
"sql": ["supabase", "postgresql", "prisma"],
|
|
||||||
"nosql": ["mongodb", "redis"],
|
|
||||||
"analytics": ["duckdb"]
|
|
||||||
},
|
|
||||||
"development_tools": {
|
|
||||||
"build_tools": ["vite", "webpack", "turbopack"],
|
|
||||||
"testing": ["jest", "detox", "playwright", "vitest"],
|
|
||||||
"containerization": ["docker", "kubernetes"],
|
|
||||||
"version_control": ["git"],
|
|
||||||
"documentation": ["mkdocs"],
|
|
||||||
"ci_cd": ["github-actions"],
|
|
||||||
"infrastructure": ["terraform"]
|
|
||||||
},
|
|
||||||
"cross_platform": {
|
|
||||||
"desktop": ["tauri", "electron"],
|
|
||||||
"mobile": ["react-native", "flutter", "expo"]
|
|
||||||
},
|
|
||||||
"ai_ml": {
|
|
||||||
"machine_learning": ["pytorch", "scikit-learn", "pandas", "tensorflow"],
|
|
||||||
"gpu_computing": ["cuda"],
|
|
||||||
"llm_tools": ["langchain", "huggingface", "vllm"],
|
|
||||||
"cloud_inference": ["modal"]
|
|
||||||
},
|
|
||||||
"web_technologies": {
|
|
||||||
"styling": ["tailwind", "css"],
|
|
||||||
"modern_patterns": ["htmx", "trpc"],
|
|
||||||
"type_checking": ["typescript", "zod"],
|
|
||||||
"http_client": ["axios", "guzzle"],
|
|
||||||
"api": ["graphql", "apollo-client"]
|
|
||||||
},
|
|
||||||
"blockchain": {
|
|
||||||
"ethereum": ["solidity", "hardhat"]
|
|
||||||
},
|
|
||||||
"cloud_platforms": {
|
|
||||||
"deployment": ["vercel", "cloudflare", "modal"],
|
|
||||||
"serverless": ["aws-lambda", "modal"],
|
|
||||||
"major_platforms": ["aws", "gcp", "azure"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +1,86 @@
|
|||||||
{
|
{
|
||||||
"frontend_frameworks/react/react": "completed",
|
"next-js": "completed",
|
||||||
"frontend_frameworks/react/react-native": "completed",
|
"langchain": "completed",
|
||||||
"frontend_frameworks/react/react-query": "completed",
|
"cuda": "completed",
|
||||||
"frontend_frameworks/react/react-redux": "completed",
|
"react-native": "completed",
|
||||||
"frontend_frameworks/react/react-mobx": "completed",
|
"zod": "completed",
|
||||||
"frontend_frameworks/vue/vue": "completed",
|
"vue": "completed",
|
||||||
"frontend_frameworks/vue/vue3": "completed",
|
"cloudflare": "completed",
|
||||||
"frontend_frameworks/angular/angular": "completed",
|
"webpack": "completed",
|
||||||
"frontend_frameworks/react/next.js": "completed",
|
"expo": "completed",
|
||||||
"frontend_frameworks/svelte/sveltekit": "completed",
|
"supabase": "completed",
|
||||||
"frontend_frameworks/qwik/qwik": "completed",
|
"gcp": "completed",
|
||||||
"frontend_frameworks/vue/nuxt": "completed",
|
"vitest": "completed",
|
||||||
"frontend_frameworks/svelte/svelte": "completed",
|
"express": "completed",
|
||||||
"backend_frameworks/nodejs/nestjs": "completed",
|
"aws": "completed",
|
||||||
"backend_frameworks/python/django": "completed",
|
"nuxt": "completed",
|
||||||
"backend_frameworks/nodejs/express": "completed",
|
"solidity": "completed",
|
||||||
"frontend_frameworks/solid/solidjs": "completed",
|
"huggingface": "completed",
|
||||||
"backend_frameworks/python/flask": "completed",
|
"tailwind": "completed",
|
||||||
"backend_frameworks/php/laravel": "completed",
|
"flutter": "completed",
|
||||||
"backend_frameworks/go/fiber": "completed",
|
"pandas": "completed",
|
||||||
"backend_frameworks/java/springboot": "completed",
|
"angular": "completed",
|
||||||
"backend_frameworks/nodejs/bun": "completed",
|
"git": "completed",
|
||||||
"backend_frameworks/python/fastapi": "completed",
|
"docker": "completed",
|
||||||
"backend_frameworks/rust/rocket": "completed",
|
"chakra-ui": "completed",
|
||||||
"backend_frameworks/go/servemux": "completed",
|
"kubernetes": "completed",
|
||||||
"ui_libraries/component_libraries/shadcn": "completed",
|
"shadcn": "completed",
|
||||||
"backend_frameworks/elixir/phoenix": "failed",
|
"tensorflow": "completed",
|
||||||
"backend_frameworks/rust/actix-web": "completed",
|
"react-redux": "completed",
|
||||||
"ui_libraries/component_libraries/tailwind": "completed",
|
"react-query": "completed",
|
||||||
"ui_libraries/component_libraries/chakra-ui": "completed",
|
"turbopack": "completed",
|
||||||
"ui_libraries/mobile_ui/jetpack-compose": "completed",
|
"material-ui": "completed",
|
||||||
"state_management/react/mobx": "completed",
|
"axios": "completed",
|
||||||
"state_management/react/redux": "completed",
|
"bun": "completed",
|
||||||
"ui_libraries/component_libraries/material-ui": "completed",
|
"flask": "completed",
|
||||||
"database_tools/sql/postgresql": "completed",
|
"sveltekit": "completed",
|
||||||
"state_management/flutter/riverpod": "completed",
|
"vite": "completed",
|
||||||
"state_management/react/zustand": "completed",
|
"terraform": "completed",
|
||||||
"database_tools/sql/supabase": "completed",
|
"fastapi": "completed",
|
||||||
"database_tools/nosql/mongodb": "completed",
|
"modal": "completed",
|
||||||
"database_tools/nosql/redis": "completed",
|
"electron": "completed",
|
||||||
"database_tools/sql/prisma": "completed",
|
"detox": "completed",
|
||||||
"database_tools/analytics/duckdb": "completed",
|
"solidjs": "completed",
|
||||||
"development_tools/build_tools/vite": "completed",
|
"riverpod": "completed",
|
||||||
"development_tools/build_tools/webpack": "completed",
|
"zustand": "completed",
|
||||||
"development_tools/testing/jest": "completed",
|
"playwright": "completed",
|
||||||
"development_tools/build_tools/turbopack": "completed",
|
"mongodb": "completed",
|
||||||
"development_tools/testing/playwright": "completed",
|
"svelte": "completed",
|
||||||
"development_tools/testing/detox": "completed",
|
"mkdocs": "completed",
|
||||||
"development_tools/version_control/git": "completed",
|
"laravel": "completed",
|
||||||
"development_tools/testing/vitest": "completed",
|
"vue3": "completed",
|
||||||
"development_tools/containerization/docker": "completed",
|
"vercel": "completed",
|
||||||
"development_tools/ci_cd/github-actions": "completed",
|
"typescript": "completed",
|
||||||
"development_tools/containerization/kubernetes": "completed",
|
"github-actions": "completed",
|
||||||
"development_tools/infrastructure/terraform": "completed",
|
"guzzle": "completed",
|
||||||
"development_tools/documentation/mkdocs": "completed",
|
"servemux": "completed",
|
||||||
"cross_platform/desktop/electron": "completed",
|
"css": "completed",
|
||||||
"cross_platform/mobile/react-native": "completed",
|
"jest": "completed",
|
||||||
"cross_platform/mobile/expo": "completed",
|
"nestjs": "completed",
|
||||||
"cross_platform/mobile/flutter": "completed",
|
"pytorch": "completed",
|
||||||
"cross_platform/desktop/tauri": "completed",
|
"apollo-client": "completed",
|
||||||
"ai_ml/machine_learning/scikit-learn": "completed",
|
"aws-lambda": "completed",
|
||||||
"ai_ml/machine_learning/pandas": "completed",
|
"qwik": "completed",
|
||||||
"ai_ml/gpu_computing/cuda": "completed",
|
"azure": "completed",
|
||||||
"ai_ml/machine_learning/tensorflow": "completed",
|
"redux": "completed",
|
||||||
"ai_ml/llm_tools/huggingface": "completed",
|
"htmx": "completed",
|
||||||
"ai_ml/llm_tools/vllm": "completed",
|
"mobx": "completed",
|
||||||
"ai_ml/cloud_inference/modal": "completed",
|
"fiber": "completed",
|
||||||
"web_technologies/styling/tailwind": "completed",
|
"hardhat": "completed",
|
||||||
"web_technologies/styling/css": "completed",
|
"redis": "completed",
|
||||||
"ai_ml/machine_learning/pytorch": "completed",
|
"react": "completed",
|
||||||
"ai_ml/llm_tools/langchain": "completed",
|
"react-mobx": "completed",
|
||||||
"web_technologies/type_checking/zod": "completed",
|
"graphql": "completed",
|
||||||
"web_technologies/type_checking/typescript": "completed",
|
"springboot": "completed",
|
||||||
"web_technologies/modern_patterns/trpc": "completed",
|
"jetpack-compose": "completed",
|
||||||
"web_technologies/http_client/axios": "completed",
|
"django": "completed",
|
||||||
"web_technologies/api/graphql": "completed",
|
"rocket": "completed",
|
||||||
"web_technologies/http_client/guzzle": "completed",
|
"tauri": "completed",
|
||||||
"web_technologies/api/apollo-client": "completed",
|
"scikit-learn": "completed",
|
||||||
"cloud_platforms/deployment/vercel": "completed",
|
"actix-web": "completed",
|
||||||
"blockchain/ethereum/solidity": "completed",
|
"trpc": "completed",
|
||||||
"cloud_platforms/deployment/modal": "completed",
|
"postgresql": "completed",
|
||||||
"web_technologies/modern_patterns/htmx": "completed",
|
"duckdb": "completed",
|
||||||
"cloud_platforms/deployment/cloudflare": "completed",
|
"prisma": "completed",
|
||||||
"blockchain/ethereum/hardhat": "completed",
|
"vllm": "completed"
|
||||||
"cloud_platforms/serverless/aws-lambda": "completed",
|
|
||||||
"cloud_platforms/major_platforms/gcp": "completed",
|
|
||||||
"cloud_platforms/serverless/modal": "completed",
|
|
||||||
"cloud_platforms/major_platforms/azure": "completed",
|
|
||||||
"cloud_platforms/major_platforms/aws": "completed"
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user