Cursor rules writen by orbitant
npm install @orbitant/cursor-rulesA Node.js package for generating and managing Cursor IDE rules and commands from templates. This package allows you to easily copy predefined Cursor rules to your project's .cursor/rules directory and commands to your .cursor/commands directory.
- Template-based Rule Generation: Copy Cursor rules from predefined templates
- Template-based Command Generation: Copy Cursor commands from predefined templates
- Selective File Management: Only manages files from this package, preserving user's custom rules and commands
- CLI Interface: Easy-to-use command-line interface
- Safe Operations: Non-destructive clean operations that preserve user files
- Smart Directory Management: Automatically handles directory creation and cleanup
Install as a dev dependency in your project:
``bash`
npm install --save-dev @orbitant/cursor-rules
#### Apply Rules and Commands
Apply all rule and command templates to your project's .cursor/ directory:
`bash`
npx @orbitant/cursor-rules apply
#### List Templates
View all available rule templates:
`bash`
npx @orbitant/cursor-rules list
#### Clean Rules and Commands
Remove only the rules and commands that were copied from this package (preserves user's custom files):
`bash`
npx @orbitant/cursor-rules clean
#### Show Help
Display available commands and usage information:
`bash`
npx @orbitant/cursor-rulesor
npx @orbitant/cursor-rules --help
Add to your package.json for easy access:
`json`
{
"scripts": {
"cursor:rules": "npx @orbitant/cursor-rules apply",
"cursor:rules:list": "npx @orbitant/cursor-rules list",
"cursor:rules:clean": "npx @orbitant/cursor-rules clean"
}
}
Then run:
`bash`
npm run cursor:rules
This package includes the following Cursor rule and command templates:
1. Template Discovery: Scans the templates/rules/ directory for .mdc files and templates/commands/ directory for .md files.cursor/rules/
2. Destination Management: Creates and .cursor/commands/ directories if they don't exist
3. File Copying: Copies each template file, preserving directory structure
4. Safe Cleanup: Only removes files that were originally copied from this package
- Non-destructive: Clean operations only remove files from this package
- Preserves User Files: Keeps any custom rules you've added to .cursor/rules/
- Smart Directory Management: Only removes empty directories
- Error Handling: Comprehensive error handling with clear messages
๐ WeOrbitant Cursor Rules Generator
================================
โ
Created directory: .cursor/rules
โ
Created directory: .cursor/commands
๐ Found 4 rule template files:
โ
Copied: readme-data-model.mdc
โ
Copied: readme-summary.mdc
โ
Copied: readme-config.mdc
โ
Copied: readme-async-messaging.mdc
๐ Found 1 command template files:
โ
Copied: update-docs.md๐ Successfully copied 4 rule files to .cursor/rules/
๐ Successfully copied 1 command file to .cursor/commands/
You can now use these rules and commands in your Cursor IDE!
`$3
`
๐งน Cleaning WeOrbitant Cursor Rules
================================
โ
Removed: readme-data-model.mdc
โ
Removed: readme-summary.mdc
โ
Removed: readme-config.mdc
โ
Removed: readme-async-messaging.mdc
โ
Removed: update-docs.md
๐ Directory .cursor/rules kept (contains other files)
๐ Directory .cursor/commands kept (contains other files)๐ Cleanup complete!
โข Removed: 5 files
โข Not found: 0 files
`๐ Integration
$3
After running the apply command, your Cursor IDE will automatically detect the rules in
.cursor/rules/ and commands in .cursor/commands/, making them available for use in your project.$3
Add to your CI/CD pipeline to ensure consistent rules and commands across environments:
`yaml
GitHub Actions example
- name: Setup Cursor Rules
run: npx @orbitant/cursor-rules apply
`๐งช Testing
The package includes comprehensive unit and integration tests:
`bash
Run all tests
npm testRun tests in watch mode
npm run test:watchRun tests with coverage
npm run test:coverage
`$3
- Unit Tests: Test individual methods and error handling
- Integration Tests: Test real file operations with temporary directories
- CLI Tests: Test command-line interface structure and functionality
๐ Requirements
- Node.js >= 14.0.0
- npm or yarn
๐ค Contributing
1. Fork the repository
2. Create a feature branch
3. Add your template files to
templates/rules/`UNLICENSED - See package.json for details
Report issues at: https://github.com/weorbitant/cursor-rules/issues
https://github.com/weorbitant/cursor-rules