@codigodoleo/wp-kit 2.0.4 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.cspell.json +5 -25
  2. package/README.md +127 -2
  3. package/lib/cli.js +1 -0
  4. package/lib/commands/init.js +32 -10
  5. package/lib/config/versions.js +163 -0
  6. package/lib/core/generator.js +63 -46
  7. package/lib/core/hook-manager.js +2 -2
  8. package/lib/core/infer-ci-capabilities.js +13 -24
  9. package/lib/prompts/index.js +31 -19
  10. package/lib/prompts/loadModulePrompts.js +4 -2
  11. package/lib/utils/generate-from-template.js +1 -0
  12. package/modules/deploy/index.js +34 -7
  13. package/modules/deploy/prompts.js +5 -5
  14. package/modules/deploy/templates/.github/workflows/ci.yml.hbs +49 -103
  15. package/modules/deploy/templates/.gitlab/gitlab-ci.yml.hbs +45 -145
  16. package/modules/deploy/templates/bitbucket-pipelines.yml.hbs +46 -97
  17. package/modules/docs/prompts.js +2 -2
  18. package/modules/docs/templates/README.md.hbs +67 -160
  19. package/modules/docs/templates/docs/Arquitetura.md +113 -92
  20. package/modules/docs/templates/docs/Deploy-Pipeline.md +22 -8
  21. package/modules/docs/templates/docs/Desenvolvimento.md +187 -164
  22. package/modules/docs/templates/docs/Getting-Started.md +37 -7
  23. package/modules/docs/templates/docs/Infraestrutura.md +41 -12
  24. package/modules/docs/templates/docs/Monitoramento.md +83 -45
  25. package/modules/docs/templates/docs/Sync-the-Production-DB-with-the-Staging-DB.md +6 -7
  26. package/modules/docs/templates/docs/Troubleshooting.md +1 -1
  27. package/modules/git/.github/PULL_REQUEST_TEMPLATE.md +1 -0
  28. package/modules/git/.gitlab/merge_request_templates/default.md +1 -0
  29. package/modules/git/.vscode/commit-instructions.md +7 -0
  30. package/modules/git/.vscode/conventional-commits.code-snippets +13 -43
  31. package/modules/git/docs/CONVENTIONAL-COMMITS.md +14 -14
  32. package/modules/git/index.js +39 -34
  33. package/modules/git/prompts.js +4 -4
  34. package/modules/git/templates/.lando.yml.hbs +5 -13
  35. package/modules/git/templates/package.json.hbs +4 -15
  36. package/modules/git/templates/workspace.json.hbs +28 -114
  37. package/modules/lint/eslint.config.mjs +36 -0
  38. package/modules/lint/index.js +1 -2
  39. package/modules/lint/prompts.js +3 -3
  40. package/modules/lint/templates/.lando.yml.hbs +2 -10
  41. package/modules/lint/templates/package.json.hbs +4 -16
  42. package/modules/lint/templates/workspace.json.hbs +15 -56
  43. package/modules/php/prompts.js +2 -2
  44. package/modules/php/templates/.lando.yml.hbs +2 -11
  45. package/modules/php/templates/composer.json.hbs +1 -6
  46. package/modules/php/templates/workspace.json.hbs +15 -74
  47. package/modules/redis/prompts.js +2 -2
  48. package/modules/redis/templates/.lando.yml.hbs +1 -8
  49. package/modules/sage/index.js +115 -7
  50. package/modules/sage/prompts.js +3 -3
  51. package/modules/sage/templates/.lando.yml.hbs +20 -64
  52. package/modules/sage/templates/theme/composer.json.hbs +3 -18
  53. package/modules/sage/templates/theme/package.json.hbs +3 -11
  54. package/modules/sage/templates/theme/style.css.hbs +20 -13
  55. package/modules/sage/templates/theme/vite.config.js.hbs +13 -53
  56. package/modules/sage/templates/workspace.json.hbs +12 -67
  57. package/modules/test-directory/prompts.js +2 -2
  58. package/package.json +20 -1
  59. package/templates/.editorconfig.hbs +5 -39
  60. package/templates/.env.hbs +14 -35
  61. package/templates/.gitignore.hbs +13 -86
  62. package/templates/.lando.yml.hbs +11 -44
  63. package/templates/README.md.hbs +7 -8
  64. package/templates/composer.json.hbs +12 -60
  65. package/templates/server/cmd/install-wp.sh.hbs +43 -58
  66. package/templates/server/www/vhosts.conf.hbs +21 -71
  67. package/templates/workspace.json.hbs +40 -177
@@ -14,7 +14,7 @@ graph LR
14
14
  A --> C[feature/another-feature]
15
15
  A --> D[hotfix/critical-fix]
16
16
  A --> E[release/v1.2.0]
17
-
17
+
18
18
  B --> F[MR to development]
19
19
  C --> F
20
20
  E --> G[MR to staging]
@@ -24,12 +24,12 @@ graph LR
24
24
  J --> I
25
25
  I --> K[MR to master]
26
26
  K --> L[master]
27
-
27
+
28
28
  D --> M[MR to master]
29
29
  M --> L
30
30
  D --> N[MR to development]
31
31
  N --> H
32
-
32
+
33
33
  style A fill:#ff6b6b
34
34
  style H fill:#feca57
35
35
  style I fill:#48dbfb
@@ -38,13 +38,13 @@ graph LR
38
38
 
39
39
  ### **Tipos de Branches**
40
40
 
41
- | Branch Type | Prefixo | Origem | Destino | Merge Via | Finalidade |
42
- |-------------|---------|--------|---------|-----------|------------|
43
- | **Feature** | `feature/` | `master` | `development` | **MR** | Novas funcionalidades |
44
- | **Bugfix** | `bugfix/` | `master` | `development` | **MR** | Correções não-críticas |
45
- | **Hotfix** | `hotfix/` | `master` | `master` + `development` | **MR** | Correções críticas |
46
- | **Release** | `release/` | `master` | `staging` → `master` | **MR** | Preparação de releases |
47
- | **Chore** | `chore/` | `master` | `development` | **MR** | Manutenção, docs, etc. |
41
+ | Branch Type | Prefixo | Origem | Destino | Merge Via | Finalidade |
42
+ | ----------- | ---------- | -------- | ------------------------ | --------- | ---------------------- |
43
+ | **Feature** | `feature/` | `master` | `development` | **MR** | Novas funcionalidades |
44
+ | **Bugfix** | `bugfix/` | `master` | `development` | **MR** | Correções não-críticas |
45
+ | **Hotfix** | `hotfix/` | `master` | `master` + `development` | **MR** | Correções críticas |
46
+ | **Release** | `release/` | `master` | `staging` → `master` | **MR** | Preparação de releases |
47
+ | **Chore** | `chore/` | `master` | `development` | **MR** | Manutenção, docs, etc. |
48
48
 
49
49
  ### **Nomenclatura de Branches**
50
50
 
@@ -108,7 +108,7 @@ graph TD
108
108
  N --> O[Final Code Review + Approval]
109
109
  O --> P[✅ Merge to master via MR]
110
110
  P --> Q[Deploy to www.pipefy.com]
111
-
111
+
112
112
  style F fill:#1dd1a1
113
113
  style K fill:#1dd1a1
114
114
  style P fill:#1dd1a1
@@ -166,7 +166,7 @@ git commit -m "fix: patch critical security vulnerability in user authentication
166
166
  git push origin hotfix/critical-security-patch
167
167
 
168
168
  # 3. DUAS Merge Requests simultâneas (OBRIGATÓRIO)
169
- #
169
+ #
170
170
  # MR 1: hotfix → master (para produção imediata)
171
171
  # - Create MR: hotfix/critical-security-patch → master
172
172
  # - Assign senior reviewers
@@ -185,22 +185,27 @@ git push origin hotfix/critical-security-patch
185
185
 
186
186
  ```markdown
187
187
  ## 🎯 Merge Request Title
188
+
188
189
  Brief description of changes
189
190
 
190
191
  ## 📝 Description
192
+
191
193
  Detailed description of what this MR does and why.
192
194
 
193
195
  ## 🔗 Related Issues
196
+
194
197
  - Closes #123
195
198
  - Relates to #456
196
199
 
197
200
  ## 🧪 Testing
201
+
198
202
  - [ ] Unit tests pass
199
203
  - [ ] Integration tests pass
200
204
  - [ ] Manual testing completed
201
205
  - [ ] Tested in local environment
202
206
 
203
207
  ## 📋 Checklist
208
+
204
209
  - [ ] Code follows project standards
205
210
  - [ ] All tests pass
206
211
  - [ ] Documentation updated
@@ -208,22 +213,25 @@ Detailed description of what this MR does and why.
208
213
  - [ ] No breaking changes (or properly documented)
209
214
 
210
215
  ## 🖼️ Screenshots (if applicable)
216
+
211
217
  Before/After screenshots for UI changes
212
218
 
213
219
  ## 🚀 Deployment Notes
220
+
214
221
  Any special deployment considerations
215
222
 
216
223
  ## 👥 Reviewers
224
+
217
225
  @senior-dev @team-lead
218
226
  ```
219
227
 
220
228
  ### **Aprovações Obrigatórias por Branch**
221
229
 
222
- | Target Branch | Reviewers Required | Auto-merge | Finalidade |
223
- |---------------|-------------------|------------|------------|
224
- | **development** | 1 senior dev | ❌ | Features, bugfixes |
225
- | **staging** | 2 senior devs | ❌ | Release preparation |
226
- | **master** | 2 senior devs + 1 lead | ❌ | Production releases |
230
+ | Target Branch | Reviewers Required | Auto-merge | Finalidade |
231
+ | --------------- | ---------------------- | ---------- | ------------------- |
232
+ | **development** | 1 senior dev | ❌ | Features, bugfixes |
233
+ | **staging** | 2 senior devs | ❌ | Release preparation |
234
+ | **master** | 2 senior devs + 1 lead | ❌ | Production releases |
227
235
 
228
236
  ### **Configuração GitLab (Merge Request Rules)**
229
237
 
@@ -232,18 +240,18 @@ Any special deployment considerations
232
240
  push_rules:
233
241
  development:
234
242
  required_approvals: 1
235
- required_approval_groups: ["senior-developers"]
243
+ required_approval_groups: ['senior-developers']
236
244
  allow_force_push: false
237
-
245
+
238
246
  staging:
239
247
  required_approvals: 2
240
- required_approval_groups: ["senior-developers"]
248
+ required_approval_groups: ['senior-developers']
241
249
  allow_force_push: false
242
250
  require_code_owner_reviews: true
243
-
251
+
244
252
  master:
245
253
  required_approvals: 2
246
- required_approval_groups: ["senior-developers", "tech-leads"]
254
+ required_approval_groups: ['senior-developers', 'tech-leads']
247
255
  allow_force_push: false
248
256
  require_code_owner_reviews: true
249
257
  dismiss_stale_reviews: true
@@ -293,56 +301,56 @@ git push origin feature/my-feature
293
301
 
294
302
  ```json
295
303
  {
296
- "name": "pipefy/wordpress-website",
297
- "description": "Pipefy WordPress Website",
298
- "type": "project",
299
- "require": {
300
- "php": ">=8.0",
301
- "composer/installers": "^2.0",
302
- "wpackagist-plugin/advanced-custom-fields-pro": "*",
303
- "wpackagist-plugin/wp-rocket": "*"
304
- },
305
- "require-dev": {
306
- "phpunit/phpunit": "^9.0",
307
- "squizlabs/php_codesniffer": "*",
308
- "dealerdirect/phpcodesniffer-composer-installer": "*",
309
- "wp-coding-standards/wpcs": "*"
310
- },
311
- "repositories": [
312
- {
313
- "type": "composer",
314
- "url": "https://wpackagist.org"
315
- },
316
- {
317
- "type": "package",
318
- "package": {
319
- "name": "advanced-custom-fields/advanced-custom-fields-pro",
320
- "version": "6.0.0",
321
- "type": "wordpress-plugin",
322
- "dist": {
323
- "type": "zip",
324
- "url": "https://connect.advancedcustomfields.com/..."
325
- }
326
- }
327
- }
328
- ],
329
- "extra": {
330
- "installer-paths": {
331
- "dist/wp-content/plugins/{$name}/": ["type:wordpress-plugin"],
332
- "dist/wp-content/themes/{$name}/": ["type:wordpress-theme"]
333
- }
304
+ "name": "pipefy/wordpress-website",
305
+ "description": "Pipefy WordPress Website",
306
+ "type": "project",
307
+ "require": {
308
+ "php": ">=8.0",
309
+ "composer/installers": "^2.0",
310
+ "wpackagist-plugin/advanced-custom-fields-pro": "*",
311
+ "wpackagist-plugin/wp-rocket": "*"
312
+ },
313
+ "require-dev": {
314
+ "phpunit/phpunit": "^9.0",
315
+ "squizlabs/php_codesniffer": "*",
316
+ "dealerdirect/phpcodesniffer-composer-installer": "*",
317
+ "wp-coding-standards/wpcs": "*"
318
+ },
319
+ "repositories": [
320
+ {
321
+ "type": "composer",
322
+ "url": "https://wpackagist.org"
334
323
  },
335
- "autoload": {
336
- "psr-4": {
337
- "Pipefy\\": "dist/wp-content/themes/pipefy-2020/inc/"
324
+ {
325
+ "type": "package",
326
+ "package": {
327
+ "name": "advanced-custom-fields/advanced-custom-fields-pro",
328
+ "version": "6.0.0",
329
+ "type": "wordpress-plugin",
330
+ "dist": {
331
+ "type": "zip",
332
+ "url": "https://connect.advancedcustomfields.com/..."
338
333
  }
339
- },
340
- "scripts": {
341
- "install-plugins": "composer install --no-dev",
342
- "test": "phpunit",
343
- "lint": "phpcs --standard=WordPress dist/wp-content/themes/pipefy-2020/",
344
- "format": "phpcbf --standard=WordPress dist/wp-content/themes/pipefy-2020/"
334
+ }
335
+ }
336
+ ],
337
+ "extra": {
338
+ "installer-paths": {
339
+ "dist/wp-content/plugins/{$name}/": ["type:wordpress-plugin"],
340
+ "dist/wp-content/themes/{$name}/": ["type:wordpress-theme"]
345
341
  }
342
+ },
343
+ "autoload": {
344
+ "psr-4": {
345
+ "Pipefy\\": "dist/wp-content/themes/pipefy-2020/inc/"
346
+ }
347
+ },
348
+ "scripts": {
349
+ "install-plugins": "composer install --no-dev",
350
+ "test": "phpunit",
351
+ "lint": "phpcs --standard=WordPress dist/wp-content/themes/pipefy-2020/",
352
+ "format": "phpcbf --standard=WordPress dist/wp-content/themes/pipefy-2020/"
353
+ }
346
354
  }
347
355
  ```
348
356
 
@@ -425,15 +433,15 @@ create_release:
425
433
  - |
426
434
  # Atualizar version no style.css
427
435
  sed -i "s/Version: .*/Version: ${CI_COMMIT_TAG#v}/" dist/wp-content/themes/pipefy-2020/style.css
428
-
436
+
429
437
  # Atualizar version no functions.php
430
438
  sed -i "s/PIPEFY_THEME_VERSION', '.*'/PIPEFY_THEME_VERSION', '${CI_COMMIT_TAG#v}'/" dist/wp-content/themes/pipefy-2020/functions.php
431
-
439
+
432
440
  # Commit das mudanças
433
441
  git add .
434
442
  git commit -m "chore: bump version to ${CI_COMMIT_TAG}"
435
443
  git push origin HEAD:master
436
-
444
+
437
445
  - echo "Release ${CI_COMMIT_TAG} created successfully"
438
446
  only:
439
447
  - tags
@@ -453,36 +461,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
453
461
  ## [Unreleased]
454
462
 
455
463
  ### Added
464
+
456
465
  - New feature in development
457
466
 
458
467
  ### Changed
468
+
459
469
  - Improved existing functionality
460
470
 
461
471
  ### Fixed
472
+
462
473
  - Bug fixes
463
474
 
464
475
  ## [1.2.3] - 2025-06-05
465
476
 
466
477
  ### Added
478
+
467
479
  - User profile avatar upload functionality
468
480
  - Enhanced security measures for file uploads
469
481
  - New Gutenberg block for testimonials
470
482
 
471
483
  ### Changed
484
+
472
485
  - Improved performance of image loading
473
486
  - Updated WordPress core to latest version
474
487
  - Refactored authentication system
475
488
 
476
489
  ### Fixed
490
+
477
491
  - Fixed responsive header issue on mobile devices
478
492
  - Resolved caching issue with dynamic content
479
493
  - Fixed accessibility issues in navigation
480
494
 
481
495
  ### Security
496
+
482
497
  - Patched XSS vulnerability in contact form
483
498
  - Updated dependencies with security fixes
484
499
 
485
500
  ## [1.2.2] - 2025-05-23
501
+
486
502
  ...
487
503
  ```
488
504
 
@@ -494,11 +510,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
494
510
  // ✅ Correto
495
511
  class UserProfileManager {
496
512
  private $userRepository;
497
-
513
+
498
514
  public function updateUserAvatar($userId, $avatarData) {
499
515
  // implementation
500
516
  }
501
-
517
+
502
518
  private function validateImageFormat($imageData) {
503
519
  // implementation
504
520
  }
@@ -507,7 +523,7 @@ class UserProfileManager {
507
523
  // ❌ Incorreto
508
524
  class GerenciadorPerfilUsuario {
509
525
  private $repositorioUsuario;
510
-
526
+
511
527
  public function atualizarAvatarUsuario($idUsuario, $dadosAvatar) {
512
528
  // implementation
513
529
  }
@@ -551,48 +567,48 @@ payment-gateway-config.php
551
567
  ```scss
552
568
  // Block: componente independente
553
569
  .hero-section {
554
- padding: 2rem;
555
- background: #fff;
556
-
557
- // Element: parte do block
558
- &__title {
559
- font-size: 2.5rem;
560
- font-weight: bold;
561
- color: #333;
562
- }
563
-
564
- &__subtitle {
565
- font-size: 1.2rem;
566
- color: #666;
570
+ padding: 2rem;
571
+ background: #fff;
572
+
573
+ // Element: parte do block
574
+ &__title {
575
+ font-size: 2.5rem;
576
+ font-weight: bold;
577
+ color: #333;
578
+ }
579
+
580
+ &__subtitle {
581
+ font-size: 1.2rem;
582
+ color: #666;
583
+ }
584
+
585
+ &__button {
586
+ padding: 1rem 2rem;
587
+ background: #007cba;
588
+ color: white;
589
+ border: none;
590
+
591
+ // Modifier: variação do element
592
+ &--large {
593
+ padding: 1.5rem 3rem;
594
+ font-size: 1.2rem;
567
595
  }
568
-
569
- &__button {
570
- padding: 1rem 2rem;
571
- background: #007cba;
572
- color: white;
573
- border: none;
574
-
575
- // Modifier: variação do element
576
- &--large {
577
- padding: 1.5rem 3rem;
578
- font-size: 1.2rem;
579
- }
580
-
581
- &--secondary {
582
- background: #666;
583
- color: white;
584
- }
596
+
597
+ &--secondary {
598
+ background: #666;
599
+ color: white;
585
600
  }
586
-
587
- // Modifier: variação do block
588
- &--dark-theme {
589
- background: #333;
590
- color: white;
591
-
592
- .hero-section__title {
593
- color: white;
594
- }
601
+ }
602
+
603
+ // Modifier: variação do block
604
+ &--dark-theme {
605
+ background: #333;
606
+ color: white;
607
+
608
+ .hero-section__title {
609
+ color: white;
595
610
  }
611
+ }
596
612
  }
597
613
  ```
598
614
 
@@ -607,27 +623,27 @@ class UserController {
607
623
  wp_send_json_error('User not found', 404);
608
624
  return;
609
625
  }
610
-
626
+
611
627
  if (!current_user_can('edit_user', $userId)) {
612
628
  wp_send_json_error('Insufficient permissions', 403);
613
629
  return;
614
630
  }
615
-
631
+
616
632
  // Update logic
617
633
  }
618
-
634
+
619
635
  public function deleteProfile($userId) {
620
636
  $user = get_user_by('ID', $userId);
621
637
  if (!$user) {
622
638
  wp_send_json_error('User not found', 404);
623
639
  return;
624
640
  }
625
-
641
+
626
642
  if (!current_user_can('delete_user', $userId)) {
627
643
  wp_send_json_error('Insufficient permissions', 403);
628
644
  return;
629
645
  }
630
-
646
+
631
647
  // Delete logic
632
648
  }
633
649
  }
@@ -640,26 +656,26 @@ class UserController {
640
656
  wp_send_json_error('User not found', 404);
641
657
  return false;
642
658
  }
643
-
659
+
644
660
  if (!current_user_can($capability, $userId)) {
645
661
  wp_send_json_error('Insufficient permissions', 403);
646
662
  return false;
647
663
  }
648
-
664
+
649
665
  return $user;
650
666
  }
651
-
667
+
652
668
  public function updateProfile($userId, $data) {
653
669
  $user = $this->validateUserAccess($userId, 'edit_user');
654
670
  if (!$user) return;
655
-
671
+
656
672
  // Update logic
657
673
  }
658
-
674
+
659
675
  public function deleteProfile($userId) {
660
676
  $user = $this->validateUserAccess($userId, 'delete_user');
661
677
  if (!$user) return;
662
-
678
+
663
679
  // Delete logic
664
680
  }
665
681
  }
@@ -676,26 +692,26 @@ namespace Pipefy\Services;
676
692
  class UserService {
677
693
  private $userRepository;
678
694
  private $emailService;
679
-
695
+
680
696
  public function __construct(UserRepository $userRepository, EmailService $emailService) {
681
697
  $this->userRepository = $userRepository;
682
698
  $this->emailService = $emailService;
683
699
  }
684
-
700
+
685
701
  public function createUser(array $userData): User {
686
702
  $this->validateUserData($userData);
687
-
703
+
688
704
  $user = $this->userRepository->create($userData);
689
705
  $this->emailService->sendWelcomeEmail($user);
690
-
706
+
691
707
  return $user;
692
708
  }
693
-
709
+
694
710
  private function validateUserData(array $data): void {
695
711
  if (empty($data['email'])) {
696
712
  throw new InvalidArgumentException('Email is required');
697
713
  }
698
-
714
+
699
715
  if (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
700
716
  throw new InvalidArgumentException('Invalid email format');
701
717
  }
@@ -721,28 +737,28 @@ class UserRepository implements UserRepositoryInterface {
721
737
  $userData = get_user_by('ID', $id);
722
738
  return $userData ? new User($userData) : null;
723
739
  }
724
-
740
+
725
741
  public function create(array $data): User {
726
742
  $userId = wp_insert_user($data);
727
-
743
+
728
744
  if (is_wp_error($userId)) {
729
745
  throw new Exception('Failed to create user: ' . $userId->get_error_message());
730
746
  }
731
-
747
+
732
748
  return $this->find($userId);
733
749
  }
734
-
750
+
735
751
  public function update(int $id, array $data): User {
736
752
  $data['ID'] = $id;
737
753
  $result = wp_update_user($data);
738
-
754
+
739
755
  if (is_wp_error($result)) {
740
756
  throw new Exception('Failed to update user: ' . $result->get_error_message());
741
757
  }
742
-
758
+
743
759
  return $this->find($id);
744
760
  }
745
-
761
+
746
762
  public function delete(int $id): bool {
747
763
  return wp_delete_user($id);
748
764
  }
@@ -761,7 +777,7 @@ class User {
761
777
  private $firstName;
762
778
  private $lastName;
763
779
  private $avatar;
764
-
780
+
765
781
  public function __construct($userData) {
766
782
  $this->id = $userData->ID;
767
783
  $this->email = $userData->user_email;
@@ -769,23 +785,23 @@ class User {
769
785
  $this->lastName = $userData->last_name;
770
786
  $this->avatar = get_user_meta($userData->ID, 'avatar', true);
771
787
  }
772
-
788
+
773
789
  public function getId(): int {
774
790
  return $this->id;
775
791
  }
776
-
792
+
777
793
  public function getEmail(): string {
778
794
  return $this->email;
779
795
  }
780
-
796
+
781
797
  public function getFullName(): string {
782
798
  return trim($this->firstName . ' ' . $this->lastName);
783
799
  }
784
-
800
+
785
801
  public function getAvatar(): ?string {
786
802
  return $this->avatar;
787
803
  }
788
-
804
+
789
805
  public function toArray(): array {
790
806
  return [
791
807
  'id' => $this->id,
@@ -825,35 +841,35 @@ composer require --dev wp-coding-standards/wpcs
825
841
  <?xml version="1.0"?>
826
842
  <ruleset name="Pipefy WordPress Coding Standards">
827
843
  <description>Pipefy WordPress coding standards</description>
828
-
844
+
829
845
  <!-- Include WordPress-Core standards -->
830
846
  <rule ref="WordPress-Core">
831
847
  <!-- Exclude filename rules -->
832
848
  <exclude name="WordPress.Files.FileName"/>
833
849
  </rule>
834
-
850
+
835
851
  <!-- Include WordPress-Extra standards -->
836
852
  <rule ref="WordPress-Extra">
837
853
  <!-- Allow short array syntax -->
838
854
  <exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
839
855
  </rule>
840
-
856
+
841
857
  <!-- Include WordPress-Docs standards -->
842
858
  <rule ref="WordPress-Docs"/>
843
-
859
+
844
860
  <!-- Check only PHP files -->
845
861
  <arg name="extensions" value="php"/>
846
-
862
+
847
863
  <!-- Show colors in output -->
848
864
  <arg name="colors"/>
849
-
865
+
850
866
  <!-- Show progress -->
851
867
  <arg value="p"/>
852
-
868
+
853
869
  <!-- Include paths -->
854
870
  <file>dist/wp-content/themes/pipefy-2020/</file>
855
871
  <file>dist/wp-content/mu-plugins/</file>
856
-
872
+
857
873
  <!-- Exclude paths -->
858
874
  <exclude-pattern>*/vendor/*</exclude-pattern>
859
875
  <exclude-pattern>*/node_modules/*</exclude-pattern>
@@ -876,49 +892,49 @@ class UserServiceTest extends TestCase {
876
892
  private $userService;
877
893
  private $userRepository;
878
894
  private $emailService;
879
-
895
+
880
896
  protected function setUp(): void {
881
897
  $this->userRepository = $this->createMock(UserRepository::class);
882
898
  $this->emailService = $this->createMock(EmailService::class);
883
899
  $this->userService = new UserService($this->userRepository, $this->emailService);
884
900
  }
885
-
901
+
886
902
  public function testCreateUserWithValidData(): void {
887
903
  $userData = [
888
904
  'email' => 'test@example.com',
889
905
  'first_name' => 'John',
890
906
  'last_name' => 'Doe'
891
907
  ];
892
-
908
+
893
909
  $expectedUser = new User((object) array_merge($userData, ['ID' => 1]));
894
-
910
+
895
911
  $this->userRepository
896
912
  ->expects($this->once())
897
913
  ->method('create')
898
914
  ->with($userData)
899
915
  ->willReturn($expectedUser);
900
-
916
+
901
917
  $this->emailService
902
918
  ->expects($this->once())
903
919
  ->method('sendWelcomeEmail')
904
920
  ->with($expectedUser);
905
-
921
+
906
922
  $result = $this->userService->createUser($userData);
907
-
923
+
908
924
  $this->assertInstanceOf(User::class, $result);
909
925
  $this->assertEquals('test@example.com', $result->getEmail());
910
926
  }
911
-
927
+
912
928
  public function testCreateUserWithInvalidEmailThrowsException(): void {
913
929
  $this->expectException(InvalidArgumentException::class);
914
930
  $this->expectExceptionMessage('Invalid email format');
915
-
931
+
916
932
  $userData = [
917
933
  'email' => 'invalid-email',
918
934
  'first_name' => 'John',
919
935
  'last_name' => 'Doe'
920
936
  ];
921
-
937
+
922
938
  $this->userService->createUser($userData);
923
939
  }
924
940
  }
@@ -932,42 +948,49 @@ class UserServiceTest extends TestCase {
932
948
  ## Code Review Checklist
933
949
 
934
950
  ### ✅ Functionality
951
+
935
952
  - [ ] Code implements requirements correctly
936
953
  - [ ] Edge cases are handled appropriately
937
954
  - [ ] Error handling is implemented
938
955
  - [ ] Performance considerations are addressed
939
956
 
940
957
  ### ✅ Code Quality
958
+
941
959
  - [ ] Code follows DRY principles
942
960
  - [ ] Functions are single-responsibility
943
961
  - [ ] Variable and function names are descriptive (in English)
944
962
  - [ ] Code is readable and well-structured
945
963
 
946
964
  ### ✅ Standards Compliance
965
+
947
966
  - [ ] Follows WordPress coding standards
948
967
  - [ ] BEM methodology for CSS
949
968
  - [ ] PSR-12 compliance for PHP
950
969
  - [ ] Semantic versioning for releases
951
970
 
952
971
  ### ✅ Security
972
+
953
973
  - [ ] Input validation is implemented
954
974
  - [ ] SQL injection prevention
955
975
  - [ ] XSS prevention
956
976
  - [ ] CSRF protection where needed
957
977
 
958
978
  ### ✅ Testing
979
+
959
980
  - [ ] Unit tests are included
960
981
  - [ ] Test coverage is adequate
961
982
  - [ ] Integration tests pass
962
983
  - [ ] Manual testing completed
963
984
 
964
985
  ### ✅ Documentation
986
+
965
987
  - [ ] Code is properly documented
966
988
  - [ ] README updated if needed
967
989
  - [ ] CHANGELOG updated for user-facing changes
968
990
  - [ ] API documentation updated
969
991
 
970
992
  ### ✅ Merge Request Process
993
+
971
994
  - [ ] MR template properly filled
972
995
  - [ ] Target branch is correct
973
996
  - [ ] Required approvals obtained
@@ -978,7 +1001,7 @@ class UserServiceTest extends TestCase {
978
1001
 
979
1002
  ```bash
980
1003
  # Formato: type(scope): description
981
- #
1004
+ #
982
1005
  # Types:
983
1006
  # feat: nova funcionalidade
984
1007
  # fix: correção de bug
@@ -1113,4 +1136,4 @@ function pipefy_get_responsive_image($attachment_id, $sizes = 'full') {
1113
1136
  📦 **Dependencies**: Composer-based plugin management
1114
1137
  🧪 **Quality**: PHPCS + Unit Tests + Code Review
1115
1138
  🎨 **Standards**: BEM + DRY + Laravel-inspired architecture
1116
- ✅ **Process**: **Merge Requests obrigatórios para staging/master**
1139
+ ✅ **Process**: **Merge Requests obrigatórios para staging/master**