UNPKG

cursor-rules-agent

Version:

Minimal Cursor IDE workflow rules integration with auto-mapping and multi-source capabilities

713 lines (548 loc) β€’ 24 kB
# πŸ€– Cursor Rules Agent v2.0.0 ## Multi-Source Website Clone & AI Workflow System *An intelligent agent system for Cursor IDE that provides advanced workflow management, multi-source data consistency, and automated assistance for complex website cloning projects.* --- ## πŸš€ **Key Features** ### **🎯 Multi-Source Data Consistency** (NEW!) - **Intelligent Multi-Source Analysis** - Analyze and compare multiple data sources simultaneously - **Real-Time Conflict Resolution** - 91% automated conflict resolution with smart merge strategies - **Data Fusion Architecture** - Master data repository with canonical records and audit trail - **Cross-Source Validation** - Maintain 96% data accuracy across multiple sources ### **🌐 Advanced Website Clone Workflow** - **Target Analysis Mode** - Deep website analysis including technical stack and legal compliance - **Architecture Planning** - Multi-layer scraping architecture with performance optimization - **Integration Testing** - Comprehensive scraping validation and quality assurance - **Content Sync** - Production content management with real-time monitoring ### **🧠 Intelligent Workflow Management** - **Multi-Mode System**: 8 specialized modes (Brainstorming β†’ Planning β†’ Developing β†’ Testing β†’ Sync β†’ Documentation) - **Context Intelligence**: Automatically loads relevant context based on current mode and task - **MCP Tools Integration**: Enhanced with Model Context Protocol tools for advanced functionality - **Safe Code Generation**: Enforces Read-Modify-Write-Verify cycle for code changes ### **πŸ†• Cursor IDE Integration** - **Auto-Rule Mapping**: Converts workflow rules to Cursor IDE format with appropriate Apply modes - **Smart Apply Modes**: Automatically sets Always, Agent Requested, Auto Attached, or Manual modes - **Custom Agent Modes**: Pre-configured specialized agents for different workflow phases - **MCP Tools Integration**: Web search, sequential thinking, and interactive tools --- ## ⚑ **Quick Installation** ### **πŸ”“ Public Repository Installation** ```bash # One-line setup (recommended) curl -fsSL https://raw.githubusercontent.com/vietnguyen91/cursor-rules/main/scripts/install.sh | bash # NPX alternative npx cursor-rules-agent install ``` ### **πŸ”„ Existing Project Integration** **Đã cΓ³ dα»± Γ‘n vΓ  muα»‘n Γ‘p dα»₯ng workflow nΓ y để tiαΊΏp tα»₯c phΓ‘t triển?** πŸ“‹ **[Existing Project Setup Guide](./EXISTING_PROJECT_SETUP.md)** - HΖ°α»›ng dαΊ«n chi tiαΊΏt tΓ­ch hợp workflow vΓ o dα»± Γ‘n cΓ³ sαΊ΅n ```bash # Quick setup for existing projects curl -sSL https://raw.githubusercontent.com/vietnguyen91/cursor-rules/main/scripts/setup-existing.sh | bash # Or manual setup git clone https://github.com/vietnguyen91/cursor-rules.git .cursor-rules-temp cp -r .cursor-rules-temp/src .cursor-rules/ cp .cursor-rules-temp/EXISTING_PROJECT_SETUP.md ./ rm -rf .cursor-rules-temp ``` **Workflow sαΊ½ tα»± Δ‘α»™ng phΓ‘t hiện trαΊ‘ng thΓ‘i hiện tαΊ‘i cα»§a dα»± Γ‘n:** - βœ… **Dα»± Γ‘n cΓ³ source code** β†’ Developing Mode hoαΊ·c Planning Mode - βœ… **Dα»± Γ‘n Δ‘ang scraping** β†’ Integration Testing Mode - βœ… **Dα»± Γ‘n production** β†’ Content Sync Mode - βœ… **CαΊ§n thΓͺm feature** β†’ Brainstorming/Planning Mode --- ### **πŸ”‘ GitHub Token Setup Guide** 1. **Create Token**: Go to [GitHub Settings > Personal Access Tokens](https://github.com/settings/tokens) 2. **Generate New Token**: Click "Generate new token (classic)" 3. **Configure Scopes**: Select `repo` for private repositories 4. **Copy Token**: Save it securely - you won't see it again 5. **Set Environment**: `export GITHUB_TOKEN=your_token_here` **⚠️ Security Note**: Never commit tokens to git. Use `.env` files and add them to `.gitignore`. --- ## 🎬 **Project Setup Guide** ### **πŸ”„ Progressive Workflow (Recommended)** Most successful projects follow this progression: #### **Phase 1: Single Source Clone (Get to Market Fast)** ```bash # 1. Create new project directory mkdir my-clone-project && cd my-clone-project # 2. Install Cursor Rules Agent npx cursor-rules-agent install # 3. Initialize for single-source website cloning npx cursor-rules-agent init --type="website-clone" # 4. Clone your primary source # In Cursor IDE: "clone website rophim.me" ``` **Perfect for:** MVP, proof of concept, getting to production quickly #### **Phase 2: Multi-Source Expansion (Scale & Improve)** ```bash # 5. When ready to enhance with additional sources # In Cursor IDE: "analyze all sources for data consistency" # Or: "add new source phimmoi.sale for better episode data" ``` **Perfect for:** Improving data quality, adding redundancy, competitive advantage --- ### **🎯 Direct Multi-Source Setup (Advanced)** Use when you already know multiple sources upfront: ```bash # 1. Setup project npx cursor-rules-agent install # 2. Initialize for multi-source npx cursor-rules-agent init --type="multi-source" # 3. Start with comprehensive analysis # In Cursor IDE: "analyze sources: rophim.me, phimmoi.sale, imdb.com" ``` **Perfect for:** Enterprise projects, data aggregation platforms, comparison sites --- ### **πŸ€” Decision Matrix: Which Approach to Choose?** | Scenario | Recommended Approach | Reason | |----------|---------------------|---------| | 🎬 **"TΓ΄i muα»‘n clone rophim.me"** | **Phase 1: Single Source** | Get MVP fast, learn the domain | | πŸ”„ **"Clone rophim + thΓͺm nguα»“n khΓ‘c sau"** | **Progressive Workflow** | Best balance of speed + scalability | | 🎯 **"TΓ΄i biαΊΏt cαΊ§n 3+ sources tα»« Δ‘αΊ§u"** | **Direct Multi-Source** | Save time, enterprise approach | | πŸ“Š **"Test concept trΖ°α»›c khi Δ‘αΊ§u tΖ°"** | **Phase 1: Single Source** | Minimal risk, quick validation | | πŸš€ **"Production system for business"** | **Progressive Workflow** | Proven approach, manageable complexity | ### **For Regular Development Projects:** ```bash # 1. Install in existing project npx cursor-rules-agent install # 2. Auto-detect project type npx cursor-rules-agent init --auto # 3. Start brainstorming # In Cursor IDE: "brainstorm new feature ideas" ``` --- ## πŸ”„ **Workflow Modes** ### **πŸ” Multi-Source Analysis Mode** (NEW!) - **Activation**: "analyze all sources", "compare sources", "multi-source" - **Capabilities**: Source quality scoring, conflict detection, data fusion strategy - **Output**: Multi-source analysis report with resolution strategies ### **🎯 Target Analysis Mode** - **Activation**: "clone website X", "analyze target", "scrape from" - **Capabilities**: Technical stack detection, content mapping, legal compliance - **Output**: Comprehensive target analysis with scraping strategy ### **πŸ—οΈ Architecture Planning Mode** - **Activation**: Auto-triggered after analysis completion - **Capabilities**: Multi-source data fusion, database design, performance optimization - **Output**: Complete architecture blueprint with implementation roadmap ### **πŸ’» Developing Mode** - **Activation**: "start coding TASK_X", task status = "approved" - **Capabilities**: Safe code generation, context-aware development, automated testing - **Output**: Production-ready code with comprehensive testing ### **πŸ”¬ Integration Testing Mode** - **Activation**: "test scraping", "validate data", development completion - **Capabilities**: Multi-source validation, data quality testing, performance testing - **Output**: Quality assurance report with deployment readiness ### **πŸ”„ Content Sync Mode** - **Activation**: "sync content", "monitor sources", production deployment - **Capabilities**: Real-time conflict resolution, source monitoring, automated recovery - **Output**: Live production management with 99.7% uptime --- ## πŸ“Š **Proven Results** ### **Real-World Performance (Rophim Project):** ```yaml Multi-Source Integration Results: - Data Coverage: 78% β†’ 96% (+18%) - Conflict Resolution: 91% automated - System Uptime: 99.7% - Content Freshness: 1.2 hours average - Video Availability: +35% improvement - Manual Maintenance: -75% reduction Development Efficiency: - 50% faster than traditional approach - 8-week completion for 15,000-page site - 99.2% data integrity maintained - 95% automation in content management ``` --- ## πŸ› οΈ **Advanced Configuration** ### **Multi-Source Setup:** ```javascript // .cursor-rules-config.js module.exports = { mode: "multi-source", sources: { primary: { name: "main-site.com", priority: 1, reliability: 0.95 }, secondary: { name: "backup-site.com", priority: 2, reliability: 0.87 }, enrichment: { name: "api-service.com", priority: 3, reliability: 0.99 } }, conflict_resolution: { strategy: "intelligent_merge", automation_threshold: 0.8, manual_review_queue: true }, quality_monitoring: { real_time_validation: true, consistency_threshold: 0.94, alert_on_degradation: true } } ``` ### **Website Clone Configuration:** ```yaml # .cursor-rules.yaml website_clone: target_analysis: legal_compliance: true performance_baseline: true content_structure_mapping: true scraping_strategy: multi_layer_architecture: true intelligent_rate_limiting: true content_deduplication: true deployment: staging_validation: true production_monitoring: true automated_rollback: true ``` --- ## πŸ”„ **Transition Guide: Single β†’ Multi-Source** ### **When to Make the Transition:** - βœ… Single source clone is **stable and in production** - βœ… User feedback indicates **missing content** or **poor video quality** - βœ… You've **identified additional reliable sources** - βœ… Ready to **invest in data quality improvements** ### **How to Transition:** ```bash # 1. Backup current production system git tag v1.0-single-source # 2. Enable multi-source analysis in existing project # In Cursor IDE: "upgrade to multi-source architecture" # 3. Start incremental source addition "add source phimmoi.sale for episode enhancement" # 4. Monitor and optimize "monitor data consistency across sources" ``` ### **Expected Improvements After Transition:** - πŸ“Š **Data Coverage**: 78% β†’ 96% (+18%) - 🎯 **Content Accuracy**: Significant improvement with cross-validation - πŸš€ **Video Availability**: +35% more working video links - πŸ”§ **Maintenance**: 75% reduction in manual fixes --- ## 🎯 **Use Cases** ### **βœ… Perfect For:** - **Movie/Entertainment Sites** (like rophim, phimmoi) - **E-commerce Platforms** with multiple suppliers - **News Aggregation** from multiple sources - **Real Estate Listings** with various APIs - **Job Boards** aggregating from multiple sites - **Product Comparison** sites with multiple data sources ### **βœ… Also Great For:** - Any website cloning project - Multi-API integration projects - Data consistency management - Large-scale scraping operations - Content management systems --- ## πŸ“š **Documentation & Examples** ### **Comprehensive Guides:** - πŸ“– [Multi-Source Workflow Example](./MULTI_SOURCE_WORKFLOW_EXAMPLE.md) - Real rophim project case study - 🌐 [Website Clone Workflow](./WEBSITE_CLONE_WORKFLOW_EXAMPLE.md) - Complete clone methodology - βš™οΈ [Installation Guide](./installer-README.md) - Detailed setup instructions - πŸ“ [User Rules Template](./USER_RULES_TEMPLATE.md) - Customization guide ### **Technical References:** - πŸ€– [Cursor Agent Documentation](./knowledge/cursor-agent.md) - Deep dive into Cursor Agent - πŸ“ [Cursor Rules Documentation](./knowledge/cursor-rules.md) - Master the Cursor Rules system - πŸ—οΈ [Architecture Overview](./src/core/) - Core system architecture - πŸ”§ [Mode Documentation](./src/modes/) - All workflow modes --- ## πŸš€ **Enhanced MCP Tools Integration** ### **Core MCP Tools:** #### 1. **Web Search Tool** 🌐 - **Purpose**: Real-time internet research for current best practices - **Usage in Brainstorming**: Research latest trends, technologies, and solutions - **Usage in Planning**: Validate architectural decisions against industry standards #### 2. **Sequential Thinking** 🧠 - **Purpose**: Enable deep, structured reasoning for complex problems - **Usage in Multi-Source Analysis**: Systematic conflict resolution - **Usage in Architecture Planning**: Complex system design #### 3. **Interactive MCP** πŸ’¬ - **Purpose**: Real-time user input without breaking thought flow - **Usage in All Modes**: Clarify requirements, confirm decisions, get feedback #### 4. **Playwright Integration** 🎭 - **Purpose**: Automated browser testing and interaction - **Usage in Testing**: Comprehensive scraping validation - **Usage in Monitoring**: Production health checks --- ## 🀝 **Community & Support** ### **Getting Help:** - πŸ“– **Documentation**: Complete guides and examples - πŸ’¬ **Issues**: [GitHub Issues](https://github.com/vietnguyen91/cursor-rules/issues) - πŸš€ **Feature Requests**: [Discussions](https://github.com/vietnguyen91/cursor-rules/discussions) - πŸ“§ **Contact**: [vietnguyen91@example.com](mailto:vietnguyen91@example.com) ### **Contributing:** ```bash # 1. Fork the repository # 2. Create feature branch git checkout -b feature/amazing-feature # 3. Make changes and test npm test # 4. Commit with conventional commits git commit -m "feat: add amazing feature" # 5. Push and create PR git push origin feature/amazing-feature ``` --- ## πŸŽ‰ **Quick Start Examples** ### **Progressive Movie Site Development:** ```bash # Phase 1: Single Source MVP npx cursor-rules-agent install npx cursor-rules-agent init --type="website-clone" # In Cursor IDE - Start simple "clone website rophim.me" # β†’ Target Analysis Mode # β†’ Complete single-source clone # β†’ Production ready in 2-4 weeks # Phase 2: Multi-Source Enhancement (when ready) "analyze all sources for data consistency" # β†’ Multi-Source Analysis Mode # β†’ Discovers phimmoi.sale, IMDB, etc. # β†’ Designs conflict resolution # β†’ Enhanced site with 96% data accuracy ``` ### **Aggregate E-commerce Data:** ```bash # Setup npx cursor-rules-agent init --type="multi-source" # In Cursor IDE "analyze all e-commerce sources for product data" # β†’ Multi-source analysis of Amazon, eBay, Shopify APIs # β†’ Conflict resolution for pricing, descriptions # β†’ Real-time sync with inventory management ``` --- ## πŸ“œ **License & Credits** **MIT License** - see [LICENSE](./LICENSE) file for details **Acknowledgments:** - Built for the Cursor IDE community - Inspired by real-world website cloning challenges - Powered by advanced MCP tools integration --- ## πŸ“‘ **System Architecture** ### **Directory Structure** ``` cursor-rules-agent/ β”œβ”€β”€ src/ # Workflow system source code β”‚ β”œβ”€β”€ core/ # Core orchestration rules β”‚ β”‚ β”œβ”€β”€ master-orchestrator.mdc β”‚ β”‚ └── context-loader.mdc β”‚ β”œβ”€β”€ modes/ # Operating modes β”‚ β”‚ β”œβ”€β”€ multi-source-analysis-mode.mdc # NEW! β”‚ β”‚ β”œβ”€β”€ target-analysis-mode.mdc β”‚ β”‚ β”œβ”€β”€ architecture-planning-mode.mdc β”‚ β”‚ β”œβ”€β”€ developing-mode.mdc β”‚ β”‚ β”œβ”€β”€ integration-testing-mode.mdc β”‚ β”‚ β”œβ”€β”€ content-sync-mode.mdc β”‚ β”‚ └── documenting-mode.mdc β”‚ β”œβ”€β”€ utilities/ # Support tools β”‚ β”‚ β”œβ”€β”€ safe-code-generation.mdc β”‚ β”‚ └── enforcer.mdc β”‚ └── templates/ # Standard templates β”‚ β”œβ”€β”€ target-analysis-template.md β”‚ β”œβ”€β”€ scraping-blueprint-template.yaml β”‚ └── task-templates/ β”œβ”€β”€ MULTI_SOURCE_WORKFLOW_EXAMPLE.md # Real-world example β”œβ”€β”€ WEBSITE_CLONE_WORKFLOW_EXAMPLE.md # Clone methodology β”œβ”€β”€ USER_RULES_TEMPLATE.md # Customization guide └── README.md # This file ``` --- **πŸš€ Ready to build your next multi-source website clone? Get started in under 5 minutes!** **Version**: 2.0.0 (Multi-Source Release) **Repository**: https://github.com/vietnguyen91/cursor-rules **Last Updated**: January 2025 # 🎯 Enhanced Multi-Source Workflow with Cursor IDE Integration > **Advanced workflow automation for website cloning and multi-source data projects with seamless Cursor IDE integration** ## 🌟 Key Features ### Enhanced Multi-Source Capabilities - **7-Mode Workflow**: Initializing β†’ Target Analysis β†’ Brainstorming β†’ Architecture Planning β†’ Developing β†’ Integration Testing β†’ Content Sync - **Multi-Source Data Management**: Comprehensive framework for handling multiple data sources with conflict resolution - **Advanced Data Fusion**: 91% automated conflict resolution with smart prioritization ### **πŸ†• Cursor IDE Integration** - **Auto-Rule Mapping**: Converts workflow rules to Cursor IDE format with appropriate Apply modes - **Smart Apply Modes**: Automatically sets Always, Agent Requested, Auto Attached, or Manual modes - **Custom Agent Modes**: Pre-configured specialized agents for different workflow phases - **MCP Tools Integration**: Web search, sequential thinking, and interactive tools ## πŸš€ Quick Start ### Option 1: New Project with Cursor Integration ```bash # Clone the enhanced workflow git clone https://github.com/your-repo/cursor-rules-agent.git cd cursor-rules-agent # Convert and deploy to Cursor format npm run convert-to-cursor-rules npm run deploy-cursor-rules /path/to/your/project # Validate setup npm run validate-cursor-rules ``` ### Option 2: Add to Existing Project ```bash # Add Cursor integration to existing project ./scripts/convert-to-cursor-rules.sh /path/to/existing/project # Open in Cursor IDE cursor /path/to/existing/project ``` ## πŸ“ Cursor Rules Structure After conversion, your project will have: ``` .cursor/ β”œβ”€β”€ rules/ β”‚ β”œβ”€β”€ core/ # Always Apply rules β”‚ β”‚ β”œβ”€β”€ master-orchestrator-always.mdc β”‚ β”‚ β”œβ”€β”€ context-loader-always.mdc β”‚ β”‚ └── enforcer-always.mdc β”‚ β”œβ”€β”€ modes/ # Mode-specific rules β”‚ β”‚ β”œβ”€β”€ brainstorming-agent.mdc # Agent Requested β”‚ β”‚ β”œβ”€β”€ target-analysis-agent.mdc # Agent Requested β”‚ β”‚ β”œβ”€β”€ developing-auto.mdc # Auto Attached to src/** β”‚ β”‚ β”œβ”€β”€ content-sync-auto.mdc # Auto Attached to content/** β”‚ β”‚ └── ... β”‚ β”œβ”€β”€ utilities/ # Safety and quality rules β”‚ β”œβ”€β”€ templates/ # Manual reference templates β”‚ └── knowledge/ # Manual knowledge base β”œβ”€β”€ mcp.json # MCP tools configuration └── modes.json # Custom agent definitions ``` ## 🎯 Rule Apply Modes | Mode | Usage | Example | |------|-------|---------| | **Always** | Applied to every chat/command | Core orchestration, safety rules | | **Agent Requested** | AI decides when to apply | Mode-specific behaviors, strategic planning | | **Auto Attached** | Triggered by file patterns | `src/**/*.ts` β†’ developing rules | | **Manual** | Explicit reference only | Templates, knowledge base | ## πŸ€– Custom Agents ### Pre-configured Specialized Agents: - **Website Clone Agent**: Legal compliance, technical feasibility, scraping optimization - **Multi-Source Data Agent**: Data fusion, conflict resolution, consistency management - **Architecture Planner**: System design, scalability, best practices - **Safe Code Developer**: RMWV cycle, testing, error handling ## πŸ“Š Multi-Source Enhancement Features ### Advanced Data Analysis - **Source Classification**: Primary, secondary, enrichment sources with quality scoring - **Content Overlap Detection**: Automated duplicate identification and conflict flagging - **Data Fusion Pipeline**: 4-layer architecture (ingestion β†’ normalization β†’ conflict resolution β†’ master data) ### Real-time Monitoring - **Cross-source Consistency**: Real-time validation across multiple data sources - **Automated Conflict Resolution**: 91% success rate with smart prioritization rules - **Performance Metrics**: 99.7% uptime, 96% data accuracy across sources ## πŸ›  Available Commands ### Development Commands ```bash # Convert workflow rules to Cursor format npm run convert-to-cursor-rules # Validate Cursor rules format npm run validate-cursor-rules # Deploy rules to project npm run deploy-cursor-rules [target-path] # Demo rule types and validation npm run demo-rule-types # Test Cursor integration npm run test-cursor-integration ``` ### Backup & Migration ```bash # Backup current rules before conversion npm run backup-rules # Setup new project with full workflow npm run setup-project [project-path] ``` ## πŸ“‹ Validation & Testing ### Automatic Validation - **Frontmatter Format**: Ensures correct YAML structure - **Rule Type Consistency**: Validates apply modes match file naming - **Dependency Checking**: Prevents circular rule dependencies - **Performance Analysis**: Monitors rule loading times ### Manual Testing ```bash # Validate all rules npm run validate-cursor-rules # Test specific rule types npm run validate-cursor-rules .cursor/rules/modes # Performance check npm run test-cursor-integration ``` ## πŸ”§ Configuration ### MCP Tools Setup The system auto-configures these MCP tools: - **Context7**: Enhanced codebase context and API documentation - **Web Search**: Real-time information retrieval - **Sequential Thinking**: Complex problem decomposition - **Interactive MCP**: User confirmation and feedback loops ### Custom Agent Configuration Edit `.cursor/modes.json` to customize agent behaviors: ```json { "modes": [ { "name": "Your Custom Agent", "description": "Specialized for your use case", "systemPrompt": "Your custom instructions...", "model": "claude-3.5-sonnet", "tools": { "codebase": true, "web": true } } ] } ``` ## πŸ“ˆ Success Metrics ### Real-world Performance (rophim project example): - **3 Sources Integrated**: rophim.me (primary), phimmoi.sale (secondary), IMDB API (enrichment) - **96% Data Accuracy** across all sources - **91% Automated Conflict Resolution** - **99.7% System Uptime** - **35% Improvement** in video source availability - **75% Reduction** in manual maintenance ## πŸ”„ Migration Guide ### From Standard Workflow to Cursor Integration: 1. **Backup existing setup**: ```bash npm run backup-rules ``` 2. **Run conversion**: ```bash npm run convert-to-cursor-rules ``` 3. **Validate conversion**: ```bash npm run validate-cursor-rules ``` 4. **Test in Cursor IDE**: - Open project in Cursor - Check Settings > Rules for loaded rules - Test agent modes in chat interface 5. **Fine-tune as needed**: - Adjust rule descriptions for better AI decisions - Modify glob patterns for more precise targeting - Customize agent prompts for your workflow ## 🧰 Advanced Usage ### Rule Creation Best Practices - **Always Rules**: Limit to 3-5 core rules for performance - **Agent Rules**: Provide comprehensive descriptions for AI decision-making - **Auto Rules**: Use specific glob patterns to avoid false triggers - **Manual Rules**: Keep for reference materials and templates ### Performance Optimization - Use `.cursorindexignore` to exclude large data files - Monitor rule loading times with validation tools - Consolidate related rules to reduce context switching ## 🀝 Contributing Contributions welcome! Please: 1. Test changes with `npm run validate-cursor-rules` 2. Update documentation for new features 3. Follow the established rule naming conventions 4. Include examples for new rule types ## πŸ“„ License MIT License - Enhanced for multi-source workflow automation --- **🎯 Enhanced Multi-Source Workflow v2.0** - Seamless Cursor IDE integration with advanced multi-source data management capabilities