Update README with comprehensive project documentation and usage guide

- Restructure README for better readability and clarity
- Add detailed instructions for setting up environment variables
- Expand usage examples and CLI options
- Include new section on adding library rules
- Add project structure overview
- Introduce CLI tool documentation
- Update configuration and setup guidance
This commit is contained in:
sanjeed5
2025-03-03 23:26:38 +05:30
parent ff0eb34a2b
commit 5948b203b0
+72 -31
View File
@@ -33,7 +33,7 @@ This project generates Cursor MDC (Markdown Cursor) rule files from a structured
``` ```
3. Set up environment variables: 3. Set up environment variables:
Create a `.env` file in the project root with your API keys: Create a `.env` file in the project root with your API keys (see `.env.example`):
``` ```
EXA_API_KEY=your_exa_api_key EXA_API_KEY=your_exa_api_key
GOOGLE_API_KEY=your_google_api_key # For Gemini GOOGLE_API_KEY=your_google_api_key # For Gemini
@@ -42,24 +42,15 @@ This project generates Cursor MDC (Markdown Cursor) rule files from a structured
# ANTHROPIC_API_KEY=your_anthropic_api_key # ANTHROPIC_API_KEY=your_anthropic_api_key
``` ```
## Configuration
The script uses a `config.yaml` file for configuration. You can modify this file to adjust:
- API rate limits
- Output directories
- LLM model selection
- Processing parameters
## Usage ## Usage
Run the script with: Run the generator script with:
```bash ```bash
uv run src/generate_mdc_files.py uv run src/generate_mdc_files.py
``` ```
By default, the script will only process libraries that failed in previous runs. This behavior helps ensure reliability and efficiency. By default, the script will only process libraries that failed in previous runs.
### Command-line Options ### Command-line Options
@@ -74,37 +65,87 @@ By default, the script will only process libraries that failed in previous runs.
### Examples ### Examples
Process failed libraries (default behavior):
```bash ```bash
# Process failed libraries (default behavior)
uv run src/generate_mdc_files.py uv run src/generate_mdc_files.py
```
Regenerate all libraries: # Regenerate all libraries
```bash
uv run src/generate_mdc_files.py --regenerate-all uv run src/generate_mdc_files.py --regenerate-all
```
Process only Python libraries: # Process only Python libraries
```bash
uv run src/generate_mdc_files.py --tag python uv run src/generate_mdc_files.py --tag python
```
Process a specific library: # Process a specific library
```bash
uv run src/generate_mdc_files.py --library react uv run src/generate_mdc_files.py --library react
``` ```
## Adding New Rules
Adding support for new libraries is simple:
1. **Edit the rules.json file**:
- Add a new entry to the `libraries` array:
```json
{
"name": "your-library-name",
"tags": ["relevant-tag1", "relevant-tag2"]
}
```
2. **Generate the MDC files**:
- Run the generator script:
```bash
uv run src/generate_mdc_files.py
```
- The script automatically detects and processes new libraries
3. **Contribute back**:
- Test your new rules with real projects
- Consider raising a PR to contribute your additions back to the community
## Configuration
The script uses a `config.yaml` file for configuration. You can modify this file to adjust:
- API rate limits
- Output directories
- LLM model selection
- Processing parameters
## CLI Tool
We provide a [CLI tool](./cursor-rules-cli/README.md) that helps developers find and install the right Cursor rules for their projects. It scans projects to identify libraries and frameworks, then suggests and installs matching rules.
```bash
# Install the CLI tool
uv add cursor-rules
# Scan your project and install matching rules
cursor-rules
```
See the [CLI README](./cursor-rules-cli/README.md) for more details.
## Project Structure ## Project Structure
- `src/`: Source code directory ```
- `generate_mdc_files.py`: Main script .
- `config.yaml`: Configuration file ├── cursor-rules-cli/ # CLI tool for finding and installing rules
- `mdc-instructions.txt`: Instructions for MDC generation │ ├── src/ # CLI source code
- `logs/`: Log files directory │ ├── docs/ # CLI documentation
- `exa_results/`: Directory for Exa search results │ └── README.md # CLI usage instructions
- `rules.json`: Input file with library information ├── src/ # Main source code directory
- `rules-mdc/`: Output directory for generated MDC files │ ├── generate_mdc_files.py # Main generator script
- `pyproject.toml`: Project dependencies and metadata │ ├── config.yaml # Configuration file
│ ├── mdc-instructions.txt # Instructions for MDC generation
│ ├── logs/ # Log files directory
│ └── exa_results/ # Directory for Exa search results
├── rules-mdc/ # Output directory for generated MDC files
├── rules.json # Input file with library information
├── pyproject.toml # Project dependencies and metadata
├── .env.example # Example environment variables
└── LICENSE # MIT License
```
## License ## License