init-cursor-rules
v1.0.1
Published
CLI tool to inject Cursor rules into projects
Downloads
5
Readme
init-cursor-rules
A CLI tool to inject Cursor rules into your projects.
Overview
init-cursor-rules is a command-line utility that allows you to easily import Cursor rules from GitHub repositories into your own projects. It fetches available rules from a specified GitHub repository and lets you select which ones you want to include in your project.
Features
- Fetch Cursor rules from any GitHub repository
- Interactive searchable multi-select interface with real-time filtering
- Powerful fuzzy search to find rules by name or description
- Type directly in the selection interface to filter options instantly
- Select multiple rules with a streamlined interface
- Supports both MDC format (recommended) and JSON format rules
- Automatically creates the necessary directories in your project
- Simple to use with npx or as a global installation
Installation
Using npx (recommended)
Run directly without installation using npx:
npx f3rland/init-cursor-rules <github-project-slug>Global Installation
Alternatively, you can install the tool globally:
npm install -g f3rland/init-cursor-rulesThen use it anywhere:
init-cursor-rules <github-project-slug>Usage
Basic Usage
init-cursor-rules <github-project-slug>Where <github-project-slug> is in the format username/repository.
Examples
# Using npx
npx f3rland/init-cursor-rules Mawla/cursor_rules
# If installed globally
init-cursor-rules f3rland/init-cursor-rules
# Using a local path
init-cursor-rules -l /path/to/rulesWorkflow
- Run the command with a GitHub repository that contains Cursor rules
- The tool will fetch all available rules from the repository
- Use the interactive searchable multi-select interface:
- Type directly in the selection box to filter rules in real-time
- Fuzzy search will find matches even with partial or inexact terms
- Use arrow keys to navigate through the filtered list
- Press space to select/deselect rules
- Press enter when finished with your selection
- The selected rules will be downloaded to your project's
.cursor/rulesdirectory
Sample Rules
This repository includes sample Cursor rules that you can import:
- example.mdc - A basic rule that highlights console.log statements
- eslint-config.mdc - A rule that applies ESLint recommendations
You can test the tool by using this repository as the source:
npx f3rland/init-cursor-rules f3rland/init-cursor-rulesCursor Rules Format
According to the Cursor documentation, rules should be stored in MDC format (.mdc files). These files use a markdown-like format with metadata:
---
description: Rule description
globs: "**/*.js,**/*.ts"
alwaysApply: false
---
Your rule content here in markdown format.Rule types include:
- Always - Always included in the model context
- Auto Attached - Included when files matching a glob pattern are referenced
- Agent Requested - Available to the AI, which decides whether to include it
- Manual - Only included when explicitly mentioned
Requirements
- Node.js 16.0.0 or higher
- The target GitHub repository must have Cursor rules in the
.cursor/rulesdirectory
Development
This project uses a devcontainer for consistent development environments. To develop:
- Clone the repository
- Open with VS Code with the Remote - Containers extension
- VS Code will prompt to reopen in container - accept this
- Once inside the container, you're ready to develop
Building and Testing
# Install dependencies
npm install
# Run locally
node index.js <github-project-slug>
# Or link it to run as a CLI command
npm link
init-cursor-rules <github-project-slug>License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgements
- The Cursor team for creating an amazing editor
- The community for sharing their Cursor rules
