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:
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
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
```
## 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
Run the script with:
Run the generator script with:
```bash
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
@@ -74,37 +65,87 @@ By default, the script will only process libraries that failed in previous runs.
### Examples
Process failed libraries (default behavior):
```bash
# Process failed libraries (default behavior)
uv run src/generate_mdc_files.py
```
Regenerate all libraries:
```bash
# Regenerate all libraries
uv run src/generate_mdc_files.py --regenerate-all
```
Process only Python libraries:
```bash
# Process only Python libraries
uv run src/generate_mdc_files.py --tag python
```
Process a specific library:
```bash
# Process a specific library
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
- `src/`: Source code directory
- `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
```
.
├── cursor-rules-cli/ # CLI tool for finding and installing rules
│ ├── src/ # CLI source code
│ ├── docs/ # CLI documentation
│ └── README.md # CLI usage instructions
├── src/ # Main source code directory
│ ├── generate_mdc_files.py # Main generator script
│ ├── 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