diff --git a/.cursor/rules/README.md b/.cursor/rules/README.md index fdc82a68..31959fe7 100644 --- a/.cursor/rules/README.md +++ b/.cursor/rules/README.md @@ -50,6 +50,7 @@ Cada arquivo de regras contém: - **Exemplos práticos** - Código de exemplo - **Anti-padrões** - O que evitar - **Testes** - Como testar o código +- **Padrões de Commit** - Conventional Commits com commitlint ## Configuração do Cursor @@ -75,7 +76,7 @@ Para manter as regras atualizadas: - **Queue**: RabbitMQ + Amazon SQS - **Real-time**: Socket.io - **Storage**: AWS S3 + Minio -- **Validation**: class-validator + Joi +- **Validation**: JSONSchema7 - **Logging**: Pino - **WhatsApp**: Baileys + Meta Business API - **Integrations**: Chatwoot, Typebot, OpenAI, Dify diff --git a/.cursor/rules/core-development.mdc b/.cursor/rules/core-development.mdc index f245b99d..53038579 100644 --- a/.cursor/rules/core-development.mdc +++ b/.cursor/rules/core-development.mdc @@ -51,7 +51,7 @@ alwaysApply: true ### File and Function Organization - Node.js/TypeScript Structure - **Services**: Keep services focused and under 200 lines - **Controllers**: Keep controllers thin - only routing and validation -- **DTOs**: Use class-validator for all input validation +- **DTOs**: Use JSONSchema7 for all input validation - **Integrations**: Follow `src/api/integrations/` structure for new integrations - **Utils**: Extract common functionality into well-named utilities - **Types**: Define clear TypeScript interfaces and types @@ -78,7 +78,7 @@ alwaysApply: true - **Graceful Degradation**: Handle service failures gracefully ### Security Standards -- **Input Validation**: Validate all inputs with class-validator +- **Input Validation**: Validate all inputs with JSONSchema7 - **Authentication**: Use API keys and JWT tokens - **Rate Limiting**: Implement rate limiting for APIs - **Data Sanitization**: Sanitize sensitive data in logs @@ -117,6 +117,29 @@ alwaysApply: true - **Security Review**: Check for security vulnerabilities - **Performance Review**: Check for performance issues +### Commit Standards (Conventional Commits) +- **Format**: `type(scope): subject` (max 100 characters) +- **Types**: + - `feat` - New feature + - `fix` - Bug fix + - `docs` - Documentation changes + - `style` - Code style changes (formatting, etc) + - `refactor` - Code refactoring + - `perf` - Performance improvements + - `test` - Adding or updating tests + - `chore` - Maintenance tasks + - `ci` - CI/CD changes + - `build` - Build system changes + - `revert` - Reverting changes + - `security` - Security fixes +- **Examples**: + - `feat(api): add WhatsApp message status endpoint` + - `fix(baileys): resolve connection timeout issue` + - `docs(readme): update installation instructions` + - `refactor(service): extract common message validation logic` +- **Tools**: Use `npm run commit` (Commitizen) for guided commits +- **Validation**: Enforced by commitlint on commit-msg hook + ## Evolution API Specific Patterns ### WhatsApp Integration Patterns diff --git a/.cursor/rules/project-context.mdc b/.cursor/rules/project-context.mdc index c3523e42..0a4da37e 100644 --- a/.cursor/rules/project-context.mdc +++ b/.cursor/rules/project-context.mdc @@ -32,7 +32,7 @@ alwaysApply: true - **Queue**: RabbitMQ + Amazon SQS for message processing - **Real-time**: Socket.io for WebSocket connections - **Storage**: AWS S3 + Minio for file storage -- **Validation**: class-validator for input validation +- **Validation**: JSONSchema7 for input validation - **Logging**: Pino for structured logging - **Architecture**: Multi-tenant API with WhatsApp integrations @@ -133,7 +133,7 @@ alwaysApply: true ### Security Constraints - **AUTHENTICATION**: API key validation for all endpoints - **AUTHORIZATION**: Instance-based access control -- **INPUT VALIDATION**: Validate all inputs with class-validator +- **INPUT VALIDATION**: Validate all inputs with JSONSchema7 - **RATE LIMITING**: Prevent abuse with rate limiting - **WEBHOOK SECURITY**: Validate webhook signatures @@ -163,7 +163,7 @@ alwaysApply: true ### Integration Patterns - **SERVICE LAYER**: Business logic in service classes -- **DTO VALIDATION**: Input validation with class-validator +- **DTO VALIDATION**: Input validation with JSONSchema7 - **ERROR HANDLING**: Consistent error responses - **LOGGING**: Structured logging with correlation IDs