Instruction file imported from LebedevIV/agent_plugins_platform (
.cursor/rules/doc/cursor-protection-system.mdc). Copyright stays with the author.
Cursor Protection System
Overview
The Cursor Protection System automatically ensures that all files in the .cursor directory are written in English for maximum AI/LLM compatibility. This system provIDEs comprehensive protection through automatic translation, Git hooks, and monitoring.
Key Features
🛡️ Automatic Protection
- Real-time translation of all .cursor files to English
- Comprehensive coverage of technical terminology
- Preserves structure and formatting
- Creates backups before any changes
🔧 Git Integration
- Pre-commit hooks - automatically translate staged .cursor files
- Post-commit hooks - verify protection status after comm.ts
- Pre-push hooks - block push if Russian content is detected
- Automatic staging of translated files
📊 Monitoring and Status
- Status checking - IDEntify files that need translation
- Protection repo.ts - comprehensive status overview
- backup management - easy restoration from backups
- Integration status - verify all compone.ts are working
System Compone.ts
1. Cursor Protector (cursor-protector..js)
Main translation engine with comprehensive terminology coverage:
- Translation mappings - 500+ technical terms
- File scanning - recursive directory processing
- backup creation - automatic backup before translation
- Status reporting - detailed analysis of files
2. Git Hooks (cursor-git-hook..js)
Automatic protection during Git operations:
- Pre-commit - translate staged .cursor files
- Post-commit - verify overall protection status
- Pre-push - block push if Russian content found
- Hook management - install/uninstall hooks
3. Protection Manager (protect-cursor..js)
Complete system management:
- Full protection - translate, install hooks, commit
- System installation - setup all compone.ts
- Status checking - comprehensive protection report
- backup restoration - restore from backups
Usage
Complete Protection (Recommended)
# Protect all .cursor files, install hooks, and commit
node .cursor/rules/protect-cursor..js protect
System Installation
# Install protection system (hooks, scri.ts, .cursorignore)
node .cursor/rules/protect-cursor..js install
Status Checking
# Check protection status
node .cursor/rules/protect-cursor..js check
# Check .cursor files specifically
node .cursor/rules/cursor-protector..js check
Manual Protection
# Protect all .cursor files
node .cursor/rules/cursor-protector..js protect
# Install Git hooks
node .cursor/rules/cursor-git-hook..js install
Package.json Scri.ts
After installation, use npm scri.ts:
npm run protect-cursor # Complete protection
npm run check-cursor # Check status
npm run install-cursor-hooks # Install hooks
Translation Coverage
Technical Terminology
- Development terms - Development → development
- Architecture terms - Architecture → architecture
- Security terms - Security → security
- Performance terms - Performance → performance
- Quality terms - Quality → quality
File Structure
- Headers and titles - заголовки и названия
- Section names - названия разделов
- Status indicators - индикаторы Statusа
- Action descriptions - описания действий
Common Phrases
- Important notes - важные Notes
- Best practices - Best Practices
- Requireme.ts - Requireme.ts
- Recommendations - Recommendations
Git Hook Behavior
Pre-commit Hook
- Scans staged files for .cursor files
- Dete.ts Russian content in staged files
- Automatically translates files with Russian content
- Creates backups before translation
- Stages translated files for commit
Post-commit Hook
- Checks overall .cursor status
- Repo.ts any remaining Russian content
- Sugge.ts actions if needed
- Confirms protection status
Pre-push Hook
- Scans all .cursor files
- Blocks push if Russian content found
- ProvIDEs clear error message
- Sugge.ts protection Command
File Structure
.cursor/
├── rules/
│ ├── cursor-protector..js # Main translation engine
│ ├── cursor-git-hook..js # Git hooks
│ ├── protect-cursor..js # Protection manager
│ └── doc/
│ └── cursor-protection-system.mdc # This documentation
├── backup/ # backup directory
│ ├── pre-commit/ # Pre-commit backups
│ └── [timestamped-backups]/ # Manual backups
└── [other .cursor files] # Protected files
configuration
.cursorignore
Exclude files from automatic translation:
# Cursor Protection System
# Files that should not be automatically translated
# backup files
.cursor/backup/
# temporary files
*.tmp
*.temp
# Log files
*.log
# cache files
.cache/
node_modules/
Package.json Scri.ts
Automatically added during installation: ``.json { "scri.ts": { "protect-cursor": "node .cursor/rules/protect-cursor..js protect", "check-cursor": "node .cursor/rules/cursor-protector..js check", "install-cursor-hooks": "node .cursor/rules/cursor-git-hook..js install" } }
## Benef.ts
### **For AI/LLM Compatibility**
- **Universal accessibility** - any AI assistant can read .cursor files
- **Language consistency** - all files in English
- **Better understanding** - clear terminology for AI processing
- **Reduced confusion** - no mixed language content
### **For International Community**
- **Global accessibility** - ready for international developers
- **Standardized format** - consistent English documentation
- **Easy sharing** - no language barriers
- **Professional appearance** - English for global audience
### **For Development Workflow**
- **Automatic process** - no manual translation needed
- **Safe operation** - backups created automatically
- **Git integration** - sea.less workflow integration
- **Error prevention** - blocks problematic comm.ts/pushes
## Best Practices
### **For Users**
1. **Run complete protection** after any .cursor changes
2. **Trust automatic translation** - system is comprehensive
3. **Check backups** if translation issues occur
4. **Use English for new files** - maintain consistency
### **For AI Assista.ts**
1. **Always write .cursor files in English**
2. **Trust the protection system** - it handles translation
3. **Check protection status** if unsure
4. **Use standard terminology** from translation mappings
### **For Developers**
1. **Install protection system** in new proje.ts
2. **Extend translation mappings** as needed
3. **Test protection** before deployment
4. **Maintain backup system** for safety
## Error Handling
### **Translation Errors**
- **backup preservation** - original files always saved
- **Partial translation** - system continues with available mappings
- **Error reporting** - clear messages about issues
- **Manual fallback** - option to restore from backup
### **Git Hook Errors**
- **Translation still works** - files translated even if hooks fail
- **Manual protection option** - user can run protection manually
- **Clear error messages** - specific information about issues
- **Safe operation** - no data loss in case of hook problems
### **System Errors**
- **Graceful Degradation** - system continues with available features
- **Error logging** - detailed error information
- **Recovery options** - multiple ways to restore functionality
- **User guidance** - clear instructions for resolution
## Troubleshooting
### **Common Issues**
#### **Files not being translated**
1. Check if files are in `.cursorignore`
2. Verify file extensions (.md, .mdc)
3. Run manual protection: `node .cursor/rules/cursor-protector..js protect`
#### **Git hooks not working**
1. Check hook installation: `node .cursor/rules/cursor-git-hook..js install`
2. Verify hook permissions (should be executable)
3. Check for confli.ts with other hooks
#### **Translation quality issues**
1. Check backup files for original content
2. Extend translation mappings if needed
3. Report missing terms for system improvement
### **Debug Commands**
```bash
# Check protection status
node .cursor/rules/protect-cursor..js check
# Test translation on specific file
node .cursor/rules/cursor-protector..js protect
# Verify Git hooks
ls -la .git/hooks/
# Check backup files
ls -la .cursor/backup/
Future Enhanceme.ts
Planned Features
- API integration with translation services
- Machine learning for better translations
- Custom translation mappings per project
- Multi-language support for other languages
- Real-time translation during editing
- Translation quality scoring
Integration IDEas
- IDE plugins for real-time protection
- CI/CD integration for automated protection
- Webhook system for remote protection
- Collaborative translation for community contributions
Conclusion
The Cursor Protection System ensures that all .cursor files are automatically maintained in English for maximum AI/LLM compatibility. This creates a truly international and AI-compatible configuration system that suppo.ts global collaboration and development.
Key Benef.ts:
- ✅ Universal AI compatibility
- ✅ Automatic protection process
- ✅ Safe backup system
- ✅ Git workflow integration
- ✅ Comprehensive coverage
- ✅ Error handling and recovery