A 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:
npm install --save-dev @orbitant/cursor-rulesApply all rule and command templates to your project's .cursor/ directory:
npx @orbitant/cursor-rules applyView all available rule templates:
npx @orbitant/cursor-rules listRemove only the rules and commands that were copied from this package (preserves user's custom files):
npx @orbitant/cursor-rules cleanDisplay available commands and usage information:
npx @orbitant/cursor-rules
# or
npx @orbitant/cursor-rules --helpAdd to your package.json for easy access:
{
"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:
npm run cursor:rulesThis package includes the following Cursor rule and command templates:
- readme-async-messaging.mdc - Auto-update README with async messaging architecture
- readme-config.mdc - Auto-update README with configuration section
- readme-data-model.mdc - Auto-update README with data model documentation
- readme-development.mdc - Auto-update README with project setup and development instructions
- readme-content.mdc - Auto-update README overall, defining document sections and which template are intended to use on each one
- readme-summary.mdc - Auto-update README with summary section
- update-docs.md - Command to update project documentation
- Template Discovery: Scans the
templates/rules/directory for.mdcfiles andtemplates/commands/directory for.mdfiles - Destination Management: Creates
.cursor/rules/and.cursor/commands/directories if they don't exist - File Copying: Copies each template file, preserving directory structure
- 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!
π§Ή 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
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.
Add to your CI/CD pipeline to ensure consistent rules and commands across environments:
# GitHub Actions example
- name: Setup Cursor Rules
run: npx @orbitant/cursor-rules applyThe package includes comprehensive unit and integration tests:
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage- 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
- Node.js >= 14.0.0
- npm or yarn
- Fork the repository
- Create a feature branch
- Add your template files to
templates/rules/ - Test your changes
- Submit a pull request
UNLICENSED - See package.json for details
Report issues at: https://github.com/weorbitant/cursor-rules/issues