Skip to content

Commit a721bed

Browse files
committed
chore(rules): update input validation standards to use JSONSchema7 and add commit standards
1 parent 7088ad0 commit a721bed

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

.cursor/rules/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Cada arquivo de regras contém:
5050
- **Exemplos práticos** - Código de exemplo
5151
- **Anti-padrões** - O que evitar
5252
- **Testes** - Como testar o código
53+
- **Padrões de Commit** - Conventional Commits com commitlint
5354

5455
## Configuração do Cursor
5556

@@ -75,7 +76,7 @@ Para manter as regras atualizadas:
7576
- **Queue**: RabbitMQ + Amazon SQS
7677
- **Real-time**: Socket.io
7778
- **Storage**: AWS S3 + Minio
78-
- **Validation**: class-validator + Joi
79+
- **Validation**: JSONSchema7
7980
- **Logging**: Pino
8081
- **WhatsApp**: Baileys + Meta Business API
8182
- **Integrations**: Chatwoot, Typebot, OpenAI, Dify

.cursor/rules/core-development.mdc

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ alwaysApply: true
5151
### File and Function Organization - Node.js/TypeScript Structure
5252
- **Services**: Keep services focused and under 200 lines
5353
- **Controllers**: Keep controllers thin - only routing and validation
54-
- **DTOs**: Use class-validator for all input validation
54+
- **DTOs**: Use JSONSchema7 for all input validation
5555
- **Integrations**: Follow `src/api/integrations/` structure for new integrations
5656
- **Utils**: Extract common functionality into well-named utilities
5757
- **Types**: Define clear TypeScript interfaces and types
@@ -78,7 +78,7 @@ alwaysApply: true
7878
- **Graceful Degradation**: Handle service failures gracefully
7979

8080
### Security Standards
81-
- **Input Validation**: Validate all inputs with class-validator
81+
- **Input Validation**: Validate all inputs with JSONSchema7
8282
- **Authentication**: Use API keys and JWT tokens
8383
- **Rate Limiting**: Implement rate limiting for APIs
8484
- **Data Sanitization**: Sanitize sensitive data in logs
@@ -117,6 +117,29 @@ alwaysApply: true
117117
- **Security Review**: Check for security vulnerabilities
118118
- **Performance Review**: Check for performance issues
119119

120+
### Commit Standards (Conventional Commits)
121+
- **Format**: `type(scope): subject` (max 100 characters)
122+
- **Types**:
123+
- `feat` - New feature
124+
- `fix` - Bug fix
125+
- `docs` - Documentation changes
126+
- `style` - Code style changes (formatting, etc)
127+
- `refactor` - Code refactoring
128+
- `perf` - Performance improvements
129+
- `test` - Adding or updating tests
130+
- `chore` - Maintenance tasks
131+
- `ci` - CI/CD changes
132+
- `build` - Build system changes
133+
- `revert` - Reverting changes
134+
- `security` - Security fixes
135+
- **Examples**:
136+
- `feat(api): add WhatsApp message status endpoint`
137+
- `fix(baileys): resolve connection timeout issue`
138+
- `docs(readme): update installation instructions`
139+
- `refactor(service): extract common message validation logic`
140+
- **Tools**: Use `npm run commit` (Commitizen) for guided commits
141+
- **Validation**: Enforced by commitlint on commit-msg hook
142+
120143
## Evolution API Specific Patterns
121144

122145
### WhatsApp Integration Patterns

.cursor/rules/project-context.mdc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ alwaysApply: true
3232
- **Queue**: RabbitMQ + Amazon SQS for message processing
3333
- **Real-time**: Socket.io for WebSocket connections
3434
- **Storage**: AWS S3 + Minio for file storage
35-
- **Validation**: class-validator for input validation
35+
- **Validation**: JSONSchema7 for input validation
3636
- **Logging**: Pino for structured logging
3737
- **Architecture**: Multi-tenant API with WhatsApp integrations
3838

@@ -133,7 +133,7 @@ alwaysApply: true
133133
### Security Constraints
134134
- **AUTHENTICATION**: API key validation for all endpoints
135135
- **AUTHORIZATION**: Instance-based access control
136-
- **INPUT VALIDATION**: Validate all inputs with class-validator
136+
- **INPUT VALIDATION**: Validate all inputs with JSONSchema7
137137
- **RATE LIMITING**: Prevent abuse with rate limiting
138138
- **WEBHOOK SECURITY**: Validate webhook signatures
139139

@@ -163,7 +163,7 @@ alwaysApply: true
163163

164164
### Integration Patterns
165165
- **SERVICE LAYER**: Business logic in service classes
166-
- **DTO VALIDATION**: Input validation with class-validator
166+
- **DTO VALIDATION**: Input validation with JSONSchema7
167167
- **ERROR HANDLING**: Consistent error responses
168168
- **LOGGING**: Structured logging with correlation IDs
169169

0 commit comments

Comments
 (0)