mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-27 21:22:55 +08:00
Initialize Cursor Rules CLI project structure
- Add README with comprehensive usage instructions and CLI options - Create user guide documentation detailing tool features and usage - Add initial `__init__.py` with version information - Remove previous planning document, transitioning from planning to implementation phase
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
# Cursor Rules CLI
|
||||
|
||||
A command-line tool to scan your projects and suggest relevant Cursor rules (.mdc files) based on the libraries and frameworks you're using.
|
||||
|
||||
## Features
|
||||
|
||||
- 🔍 Automatically scans your project to detect libraries and frameworks
|
||||
- 🔄 Matches detected libraries with available Cursor rules
|
||||
- 📥 Downloads and installs relevant rules to your `.cursor/rules` directory
|
||||
- 🎨 Interactive and colorful CLI interface
|
||||
- 🔀 Supports custom repositories for advanced users
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/sanjeed5/awesome-cursor-rules-mdc
|
||||
cd awesome-cursor-rules-mdc/cursor-rules-cli
|
||||
|
||||
# Install using pip
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Scan the current directory and install relevant rules
|
||||
cursor-rules
|
||||
|
||||
# Scan a specific directory
|
||||
cursor-rules scan -d /path/to/project
|
||||
|
||||
# Show what would be done without making changes
|
||||
cursor-rules scan --dry-run
|
||||
|
||||
# Force overwrite existing rules
|
||||
cursor-rules scan --force
|
||||
|
||||
# Enable verbose output
|
||||
cursor-rules scan -v
|
||||
```
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Using a Custom Repository (untested)
|
||||
|
||||
You can use your own forked repository of Cursor rules. This is a CLI-wide setting that applies to all projects:
|
||||
|
||||
```bash
|
||||
# Use a custom repository for the current scan
|
||||
cursor-rules scan --custom-repo username/repo
|
||||
|
||||
# Set custom repository globally without running scan
|
||||
cursor-rules scan --custom-repo username/repo --set-repo
|
||||
|
||||
# Save this setting as your default configuration
|
||||
cursor-rules scan --custom-repo username/repo --save-config
|
||||
```
|
||||
|
||||
Note: Custom repository settings are always global and not project-specific. The repository must contain a valid `rules.json` file at the root level.
|
||||
|
||||
### Configuration Management
|
||||
|
||||
```bash
|
||||
# Show current configuration
|
||||
cursor-rules scan --show-config
|
||||
|
||||
# Save current settings as global configuration
|
||||
cursor-rules scan --save-config
|
||||
|
||||
# Save current settings as project-specific configuration (except repository settings)
|
||||
cursor-rules scan --save-project-config
|
||||
```
|
||||
|
||||
## Configuration Files
|
||||
|
||||
The CLI uses the following configuration files:
|
||||
|
||||
- Global configuration: `~/.cursor/rules-cli-config.json` (includes custom repository settings)
|
||||
- Project-specific configuration: `.cursor-rules-cli.json` in the project directory (excludes repository settings)
|
||||
|
||||
Project-specific configuration takes precedence over global configuration for project-specific settings.
|
||||
|
||||
## Available Options
|
||||
|
||||
```
|
||||
-h, --help Show this help message and exit
|
||||
-d DIRECTORY, --directory DIRECTORY
|
||||
Project directory to scan (default: current directory)
|
||||
--dry-run Show what would be done without making changes
|
||||
--force Force overwrite existing rules
|
||||
--source SOURCE Base URL for downloading rules
|
||||
--custom-repo CUSTOM_REPO
|
||||
GitHub username/repo for a forked repository (e.g., 'username/repo')
|
||||
--set-repo Set custom repository without running scan
|
||||
--rules-json RULES_JSON
|
||||
Path to custom rules.json file
|
||||
--save-config Save current settings as default configuration
|
||||
--save-project-config
|
||||
Save current settings as project-specific configuration (except repository settings)
|
||||
--show-config Show current configuration
|
||||
-v, --verbose Enable verbose output
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
## Todo:
|
||||
- [ ] Test the custom repo
|
||||
@@ -0,0 +1,143 @@
|
||||
# Cursor Rules CLI - User Guide
|
||||
|
||||
## Introduction
|
||||
|
||||
Cursor Rules CLI is a command-line tool that helps you discover and install relevant Cursor rules (MDC files) for your projects. The tool scans your project directory to identify libraries and frameworks, then suggests and installs appropriate rules to enhance your development experience with Cursor.
|
||||
|
||||
## Installation
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Python 3.8 or higher
|
||||
- pip (Python package installer)
|
||||
|
||||
### Installing from PyPI
|
||||
|
||||
```bash
|
||||
pip install cursor-rules
|
||||
```
|
||||
|
||||
### Installing from Source
|
||||
|
||||
```bash
|
||||
git clone https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
|
||||
cd awesome-cursor-rules-mdc/cursor-rules-cli
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
## Basic Usage
|
||||
|
||||
To scan your current project directory and install relevant rules:
|
||||
|
||||
```bash
|
||||
cursor-rules
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Scan your project directory for libraries and frameworks
|
||||
2. Match detected libraries with available rules
|
||||
3. Present a list of relevant rules for selection
|
||||
4. Download and install selected rules to your `.cursor/rules` directory
|
||||
|
||||
## Command-Line Options
|
||||
|
||||
```
|
||||
usage: cursor-rules [-h] [-d DIRECTORY] [--dry-run] [--force] [--source SOURCE]
|
||||
[--rules-json RULES_JSON] [-v]
|
||||
|
||||
Scan your project and install relevant Cursor rules (.mdc files).
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
-d DIRECTORY, --directory DIRECTORY
|
||||
Project directory to scan (default: current directory)
|
||||
--dry-run Show what would be done without making changes
|
||||
--force Force overwrite existing rules
|
||||
--source SOURCE Base URL for downloading rules
|
||||
--rules-json RULES_JSON
|
||||
Path to custom rules.json file
|
||||
-v, --verbose Enable verbose output
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
#### Scan a specific directory
|
||||
|
||||
```bash
|
||||
cursor-rules -d /path/to/your/project
|
||||
```
|
||||
|
||||
#### Dry run (no changes)
|
||||
|
||||
```bash
|
||||
cursor-rules --dry-run
|
||||
```
|
||||
|
||||
#### Force overwrite existing rules
|
||||
|
||||
```bash
|
||||
cursor-rules --force
|
||||
```
|
||||
|
||||
#### Use verbose output
|
||||
|
||||
```bash
|
||||
cursor-rules -v
|
||||
```
|
||||
|
||||
#### Use a custom rules.json file
|
||||
|
||||
```bash
|
||||
cursor-rules --rules-json /path/to/custom/rules.json
|
||||
```
|
||||
|
||||
## Interactive Selection
|
||||
|
||||
After scanning your project, the tool will present a list of relevant rules:
|
||||
|
||||
```
|
||||
Available Cursor rules for your project:
|
||||
1. react.mdc - React best practices
|
||||
2. typescript.mdc - TypeScript tips and tricks
|
||||
3. eslint.mdc - ESLint configuration help
|
||||
|
||||
Select rules to install:
|
||||
* Enter comma-separated numbers (e.g., 1,3,5)
|
||||
* Type 'all' to select all rules
|
||||
* Type 'none' to cancel
|
||||
>
|
||||
```
|
||||
|
||||
You can:
|
||||
- Enter specific numbers (e.g., `1,3`) to select individual rules
|
||||
- Type `all` to select all rules
|
||||
- Type `none` or press Enter to cancel
|
||||
|
||||
## Rule Installation
|
||||
|
||||
Selected rules will be downloaded and installed to your `.cursor/rules` directory. If a rule already exists, it will not be overwritten unless you use the `--force` option.
|
||||
|
||||
Existing rules will be backed up before being overwritten.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### No libraries detected
|
||||
|
||||
If the tool doesn't detect any libraries in your project, try:
|
||||
- Using the `-v` option for verbose output to see what the scanner is checking
|
||||
- Ensuring your project has dependency files (package.json, requirements.txt, etc.)
|
||||
- Running the tool from the root directory of your project
|
||||
|
||||
### Rule installation fails
|
||||
|
||||
If rule installation fails, check:
|
||||
- That you have write permissions to the `.cursor/rules` directory
|
||||
- That you're not trying to overwrite existing rules without the `--force` option
|
||||
- Your internet connection if downloads are failing
|
||||
|
||||
## Getting Help
|
||||
|
||||
If you encounter any issues or have questions, please:
|
||||
- Check the [GitHub repository](https://github.com/sanjeed5/awesome-cursor-rules-mdc) for updates
|
||||
- Open an issue on GitHub if you find a bug
|
||||
- Refer to the developer documentation for more technical details
|
||||
@@ -1,84 +0,0 @@
|
||||
# Cursor Rules CLI Tool Plan
|
||||
|
||||
## Overview
|
||||
A command-line tool that scans a user's project directory to identify libraries and frameworks in use, then suggests relevant Cursor rules (.mdc files) for download from the awesome-cursor-rules-mdc repository.
|
||||
|
||||
## Core Features
|
||||
1. **Project Scanning**: Detect libraries/frameworks used in the project
|
||||
2. **Rule Matching**: Match detected libraries with available MDC rules
|
||||
3. **Interactive Selection**: Allow users to select which rules to download
|
||||
4. **Installation**: Download and install selected rules to `.cursor/rules` directory
|
||||
5. **Security & Trust**: Implement measures to ensure user safety and build trust
|
||||
|
||||
## Technical Implementation
|
||||
|
||||
### Project Structure
|
||||
```
|
||||
cursor-rules-cli/
|
||||
├── src/
|
||||
│ ├── __init__.py
|
||||
│ ├── main.py # Entry point
|
||||
│ ├── scanner.py # Project scanning logic
|
||||
│ ├── matcher.py # Library matching logic
|
||||
│ ├── downloader.py # Rule downloading functionality
|
||||
│ ├── installer.py # Rule installation to .cursor/rules
|
||||
│ └── utils.py # Utility functions
|
||||
├── data/
|
||||
│ └── libraries.json # Local copy of libraries mapping
|
||||
├── tests/ # Unit tests
|
||||
├── setup.py # Package configuration
|
||||
├── README.md # Documentation
|
||||
└── LICENSE # License file
|
||||
```
|
||||
|
||||
### Workflow
|
||||
1. **Scanning Phase**:
|
||||
- Scan project for package manager files (package.json, requirements.txt, etc.)
|
||||
- Check import statements in source files
|
||||
- Identify key framework-specific files/patterns
|
||||
- Create a list of detected libraries
|
||||
|
||||
2. **Matching Phase**:
|
||||
- Fetch latest rules.json from GitHub or use local copy if unavailable
|
||||
- Cross-reference detected libraries with available MDC rules
|
||||
- Generate a list of relevant rules
|
||||
|
||||
3. **Selection Phase**:
|
||||
- Present an interactive CLI interface showing available rules
|
||||
- Allow users to select all, none, or specific rules
|
||||
- Provide brief descriptions of what each rule does
|
||||
|
||||
4. **Installation Phase**:
|
||||
- Create `.cursor/rules` directory if it doesn't exist
|
||||
- Download selected rule files from the repository
|
||||
- Display summary of downloaded rules
|
||||
|
||||
### Security Considerations
|
||||
1. **Transparency**:
|
||||
- Show preview of rule content before installation
|
||||
- Clearly indicate source URLs for downloads
|
||||
- Open source the tool itself for inspection
|
||||
|
||||
2. **Verification**:
|
||||
- Verify file integrity with checksums
|
||||
- Only download from trusted sources
|
||||
- Implement rate limiting to avoid API abuse
|
||||
|
||||
3. **User Control**:
|
||||
- Always require explicit confirmation before downloading/installing
|
||||
- Provide dry-run option to see what would happen without making changes
|
||||
- Allow users to specify custom rule sources
|
||||
|
||||
### Distribution
|
||||
1. Package as a Python package installable via pip/uv
|
||||
2. Publish to PyPI
|
||||
3. Provide standalone executables for major platforms
|
||||
|
||||
## Next Steps
|
||||
1. Develop core scanning functionality
|
||||
2. Implement library matching logic
|
||||
3. Create interactive CLI interface
|
||||
4. Build downloading and installation components
|
||||
5. Add security features
|
||||
6. Write tests and documentation
|
||||
7. Package and publish
|
||||
@@ -0,0 +1,5 @@
|
||||
"""
|
||||
Cursor Rules CLI - A tool to scan projects and suggest relevant Cursor rules
|
||||
"""
|
||||
|
||||
__version__ = "0.3.0"
|
||||
Reference in New Issue
Block a user