@codigodoleo/wp-kit 5.3.0 → 6.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 (115) hide show
  1. package/README.md +83 -96
  2. package/lib/commands/init.js +28 -26
  3. package/lib/config/versions.js +27 -1
  4. package/lib/core/cloud-allowlist.js +38 -0
  5. package/lib/core/generator.js +56 -50
  6. package/lib/core/infer-ci-capabilities.js +17 -5
  7. package/lib/prompts/index.js +105 -8
  8. package/lib/utils/auth-template.js +18 -0
  9. package/lib/utils/env-example.js +18 -6
  10. package/lib/utils/git.js +5 -188
  11. package/modules/blank-theme/index.js +1 -1
  12. package/modules/deploy/index.js +15 -0
  13. package/modules/deploy/scripts/check-exposure.sh +63 -0
  14. package/modules/deploy/templates/.github/workflows/ci.yml.hbs +28 -0
  15. package/modules/docs/index.js +18 -18
  16. package/modules/docs/templates/README.md.hbs +1 -1
  17. package/modules/docs/templates/docs/Arquitetura.md.hbs +2 -2
  18. package/modules/docs/templates/docs/Deploy-Pipeline.md.hbs +21 -1
  19. package/modules/docs/templates/docs/Development.md.hbs +236 -0
  20. package/modules/docs/templates/docs/Getting-Started.md.hbs +75 -4
  21. package/modules/docs/templates/docs/Infraestrutura.md.hbs +1 -1
  22. package/modules/docs/templates/docs/Troubleshooting.md.hbs +34 -1
  23. package/modules/git/.husky/kivo-wp/commit-msg +3 -0
  24. package/modules/git/.husky/kivo-wp/pre-commit +25 -0
  25. package/modules/git/.husky/pre-commit +3 -7
  26. package/modules/git/.lintstagedrc.json +5 -2
  27. package/modules/git/index.js +19 -2
  28. package/modules/git/templates/.lando.yml.hbs +5 -0
  29. package/modules/git/templates/package.json.hbs +1 -1
  30. package/modules/kivo-wp/fixtures/menus.json +11 -0
  31. package/modules/kivo-wp/fixtures/options.json +10 -0
  32. package/modules/kivo-wp/fixtures/posts.json +58 -0
  33. package/modules/kivo-wp/fixtures/seed.php +152 -0
  34. package/modules/kivo-wp/fixtures/terms.json +6 -0
  35. package/modules/kivo-wp/fixtures/users.json +26 -0
  36. package/modules/kivo-wp/index.js +193 -0
  37. package/modules/kivo-wp/prompts.js +1 -0
  38. package/modules/kivo-wp/templates/.devcontainer/devcontainer.json.hbs +40 -0
  39. package/modules/kivo-wp/templates/.dockerignore.hbs +15 -0
  40. package/modules/kivo-wp/templates/Dockerfile.hbs +83 -0
  41. package/modules/kivo-wp/templates/bin/_lib.sh.hbs +137 -0
  42. package/modules/kivo-wp/templates/bin/build.hbs +13 -0
  43. package/modules/kivo-wp/templates/bin/composer.hbs +6 -0
  44. package/modules/kivo-wp/templates/bin/db-export.hbs +18 -0
  45. package/modules/kivo-wp/templates/bin/db-import.hbs +26 -0
  46. package/modules/kivo-wp/templates/bin/db.hbs +6 -0
  47. package/modules/kivo-wp/templates/bin/dev.hbs +7 -0
  48. package/modules/kivo-wp/templates/bin/down.hbs +34 -0
  49. package/modules/kivo-wp/templates/bin/e2e.hbs +48 -0
  50. package/modules/kivo-wp/templates/bin/flush.hbs +11 -0
  51. package/modules/kivo-wp/templates/bin/info.hbs +15 -0
  52. package/modules/kivo-wp/templates/bin/logs.hbs +6 -0
  53. package/modules/kivo-wp/templates/bin/mago.hbs +8 -0
  54. package/modules/kivo-wp/templates/bin/node.hbs +6 -0
  55. package/modules/kivo-wp/templates/bin/npm.hbs +6 -0
  56. package/modules/kivo-wp/templates/bin/php.hbs +6 -0
  57. package/modules/kivo-wp/templates/bin/reset-deps.hbs +11 -0
  58. package/modules/kivo-wp/templates/bin/seed.hbs +21 -0
  59. package/modules/kivo-wp/templates/bin/setup.hbs +283 -0
  60. package/modules/kivo-wp/templates/bin/shell.hbs +14 -0
  61. package/modules/kivo-wp/templates/bin/stan.hbs +8 -0
  62. package/modules/kivo-wp/templates/bin/test.hbs +6 -0
  63. package/modules/kivo-wp/templates/bin/trust-cert.hbs +21 -0
  64. package/modules/kivo-wp/templates/bin/up.hbs +6 -0
  65. package/modules/kivo-wp/templates/bin/wp.hbs +6 -0
  66. package/modules/kivo-wp/templates/bin/xdebug.hbs +22 -0
  67. package/modules/kivo-wp/templates/compose.yaml.hbs +117 -0
  68. package/modules/kivo-wp/templates/content/mu-plugins/kivo-wp-local-mail.php.hbs +29 -0
  69. package/modules/kivo-wp/templates/docs/cloud-sessions.md.hbs +34 -0
  70. package/modules/kivo-wp/templates/server/caddy/Caddyfile.hbs +44 -0
  71. package/modules/kivo-wp/templates/server/nginx/deny.conf.hbs +26 -0
  72. package/modules/lint/index.js +22 -14
  73. package/modules/lint/templates/package.json.hbs +6 -0
  74. package/modules/php/index.js +18 -1
  75. package/modules/php/kivo-wp/php-wrapper.sh +3 -0
  76. package/modules/php/kivo-wp/pint-wrapper.sh +3 -0
  77. package/modules/php/templates/phpstan.neon.dist.hbs +27 -0
  78. package/modules/sage/index.js +4 -26
  79. package/modules/sage/templates/bin/theme-lint.hbs +6 -0
  80. package/modules/sage/templates/server/cmd/setup-sage-node.sh.hbs +3 -1
  81. package/modules/sage/templates/server/cmd/setup-sage-php.sh.hbs +3 -1
  82. package/modules/sage/templates/theme/vite.config.js.hbs +20 -2
  83. package/modules/sage/templates/workspace.json.hbs +0 -57
  84. package/modules/skills/index.js +56 -11
  85. package/modules/skills/prompts.js +3 -16
  86. package/modules/test/index.js +13 -11
  87. package/modules/test/phpunit.xml +18 -0
  88. package/modules/test/templates/playwright.config.js.hbs +23 -0
  89. package/modules/test/tests/SmokeTest.php +8 -9
  90. package/modules/test/tests/e2e/smoke.spec.js +28 -0
  91. package/package.json +3 -2
  92. package/templates/.env.hbs +16 -5
  93. package/templates/.gitignore.hbs +8 -1
  94. package/templates/.lando.yml.hbs +3 -9
  95. package/templates/CLAUDE.md.hbs +33 -15
  96. package/templates/README.md.hbs +38 -12
  97. package/templates/composer.json.hbs +1 -1
  98. package/templates/package.json.hbs +8 -1
  99. package/templates/server/cmd/install-wp.sh.hbs +1 -1
  100. package/templates/server/cmd/setup-node.sh.hbs +3 -1
  101. package/templates/server/cmd/setup-php.sh.hbs +63 -9
  102. package/templates/workspace.json.hbs +0 -56
  103. package/{wp-config.php → templates/wp-config.php.hbs} +56 -14
  104. package/modules/docs/templates/docs/Desenvolvimento.md.hbs +0 -127
  105. package/modules/lint/templates/.lando.yml.hbs +0 -5
  106. package/modules/sage/templates/.devcontainer/devcontainer.json.hbs +0 -7
  107. package/modules/sage/templates/.devcontainer/docker-compose.override.yml.hbs +0 -4
  108. package/modules/sage/templates/.devcontainer/post-create.sh.hbs +0 -11
  109. package/templates/.devcontainer/Dockerfile.hbs +0 -24
  110. package/templates/.devcontainer/config/nginx.conf +0 -23
  111. package/templates/.devcontainer/config/nginx.conf.hbs +0 -23
  112. package/templates/.devcontainer/devcontainer.json.hbs +0 -29
  113. package/templates/.devcontainer/docker-compose.yml.hbs +0 -76
  114. package/templates/.devcontainer/setup.sh.hbs +0 -17
  115. package/templates/auth.json.hbs +0 -8
@@ -1,127 +0,0 @@
1
- # Desenvolvimento
2
-
3
- Workflow and conventions for working on **{{projectTitle}}**.
4
-
5
- ## Git workflow
6
-
7
- This project follows a **GitFlow-derived workflow** with three long-lived
8
- branches and short-lived branches per piece of work. Adjust to your
9
- team's needs — the structure below is a sensible default.
10
-
11
- | Branch | Purpose | Auto-deploys to |
12
- | --- | --- | --- |
13
- | `main` (or `master`) | Production-ready code | {{projectProductionDomain}} |
14
- | `staging` | Pre-production validation | {{projectStagingDomain}} |
15
- | `development` | Integration of in-flight features | {{projectDevDomain}} |
16
-
17
- ### Branch types
18
-
19
- | Prefix | From | To | Purpose |
20
- | --- | --- | --- | --- |
21
- | `feature/` | `main` | `development` (via {{prTermShort}}) | New functionality |
22
- | `bugfix/` | `main` | `development` (via {{prTermShort}}) | Non-critical fixes |
23
- | `hotfix/` | `main` | `main` + `development` (via {{prTermShort}}) | Critical production fixes |
24
- | `release/` | `main` | `staging` → `main` (via {{prTermShort}}) | Release preparation |
25
- | `chore/` | `main` | `development` (via {{prTermShort}}) | Maintenance, deps, docs |
26
-
27
- ### Naming
28
-
29
- Use kebab-case in English; the prefix carries the intent.
30
-
31
- ```text
32
- feature/user-profile-avatar
33
- bugfix/header-overlap-on-mobile
34
- hotfix/auth-bypass-cve-2025-1234
35
- chore/bump-composer-deps
36
- release/v1.4.0
37
- ```
38
-
39
- ## Feature flow
40
-
41
- ```mermaid
42
- graph TD
43
- A[feature/branch off main] --> B[Open {{prTermShort}} -> development]
44
- B --> C[Code review]
45
- C --> D{Approved?}
46
- D -- No --> E[Address feedback]
47
- E --> C
48
- D -- Yes --> F[Merge to development]
49
- F --> G[Auto-deploy to {{projectDevDomain}}]
50
- G --> H[QA on dev]
51
- H --> I[{{prTermShort}} development -> staging]
52
- I --> J[Merge to staging]
53
- J --> K[Auto-deploy to {{projectStagingDomain}}]
54
- K --> L[Final validation]
55
- L --> M[{{prTermShort}} staging -> main]
56
- M --> N[Merge to main]
57
- N --> O[Auto-deploy to {{projectProductionDomain}}]
58
- ```
59
-
60
- Direct pushes to `main`, `staging`, and `development` should be blocked
61
- by branch protection — every change goes through a {{prTermShort}}.
62
-
63
- ## Commits
64
-
65
- This project uses [Conventional Commits](https://www.conventionalcommits.org/).
66
- Husky + commitlint enforce the format locally; CI re-checks on every
67
- {{prTermShort}}.
68
-
69
- ```text
70
- <type>(<scope>): <subject>
71
-
72
- <body>
73
-
74
- <footer>
75
- ```
76
-
77
- Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`,
78
- `test`, `chore`, `ci`, `build`, `revert`.
79
-
80
- Examples:
81
-
82
- ```text
83
- feat(checkout): support PIX payment method
84
- fix(header): align logo on small viewports
85
- chore(deps): bump roots/acorn to 6.2
86
- ```
87
-
88
- ## Code review checklist
89
-
90
- - [ ] The {{prTermShort}} description explains *why*, not just *what*.
91
- - [ ] CI is green (lint, tests, build).
92
- - [ ] No secrets in code or commit history.
93
- - [ ] Documentation updated when behaviour changes.
94
- - [ ] Migration / data-fix steps documented for ops.
95
- - [ ] Screenshots attached for UI changes.
96
-
97
- ## Lint and formatting
98
-
99
- ```bash
100
- npm run lint # ESLint + Stylelint
101
- npm run lint:fix # Auto-fix where possible
102
- npm run format # Prettier
103
- {{#if useSage}}composer lint --working-dir=content/themes/{{projectName}} # Pint
104
- composer lint:fix --working-dir=content/themes/{{projectName}}{{/if}}
105
- ```
106
-
107
- Husky runs lint-staged on every commit so only changed files are
108
- checked; CI re-runs the full sweep.
109
-
110
- ## Tests
111
-
112
- - **PHP**: `{{ "{{TODO: Pest suite location and how to invoke it}}" }}`
113
- - **E2E**: Playwright specs under `tests/e2e/`. Run locally with
114
- `npm run test:e2e`.
115
- - **Visual regression**: `{{ "{{TODO: define if/how visual regression is captured}}" }}`
116
-
117
- ## Releases
118
-
119
- Releases are tag-driven. The recommended flow:
120
-
121
- 1. Open a `release/vX.Y.Z` branch off `main`.
122
- 2. Bump the version in `package.json` and the project changelog.
123
- 3. {{prTermShort}} `release/vX.Y.Z` → `staging`; validate.
124
- 4. {{prTermShort}} `staging` → `main`; tag `vX.Y.Z` on the merge commit.
125
- 5. {{ciSystem}} deploys the tag to {{projectProductionDomain}}.
126
-
127
- `{{ "{{TODO: replace this section if the project adopts release-please / semantic-release}}" }}`
@@ -1,5 +0,0 @@
1
- tooling:
2
- commitlint:
3
- service: appserver
4
- description: Validate commit message format
5
- cmd: npx commitlint --edit
@@ -1,7 +0,0 @@
1
- {
2
- "dockerComposeFile": [
3
- "docker-compose.yml",
4
- "docker-compose.override.yml"
5
- ],
6
- "postCreateCommand": "bash .devcontainer/setup.sh && bash .devcontainer/post-create.sh"
7
- }
@@ -1,4 +0,0 @@
1
- services:
2
- app:
3
- environment:
4
- SAGE_THEME_DIR: /workspace/content/themes/{{projectName}}
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Sage devcontainer post-create — delegates to unified setup scripts.
3
- # Invoked from: devcontainer.json postCreateCommand.
4
- set -euo pipefail
5
-
6
- PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.."; pwd)"
7
-
8
- bash "${PROJECT_ROOT}/server/cmd/setup-sage-php.sh"
9
- bash "${PROJECT_ROOT}/server/cmd/setup-sage-node.sh"
10
-
11
- echo "Sage post-create bootstrap completed."
@@ -1,24 +0,0 @@
1
- FROM thecodingmachine/php:8.4-v5-fpm-node24
2
-
3
- # Enable PHP extensions needed for WordPress
4
- # (mysqli, mysqlnd, redis, zip already enabled by default in the fat image)
5
- ENV PHP_EXTENSION_BCMATH=1 \
6
- PHP_EXTENSION_GD=1 \
7
- PHP_EXTENSION_PDO_MYSQL=1
8
-
9
- # The base image ends with USER docker — switch to root for installations
10
- USER root
11
-
12
- # Install only what is NOT bundled in the base image.
13
- # Already pre-installed: PHP 8.4, Node 24, npm, yarn (corepack),
14
- # Composer, mysqli, mysqlnd, redis, zip, curl, git, unzip
15
- RUN apt-get update \
16
- && apt-get install -y --no-install-recommends default-mysql-client redis-tools \
17
- && rm -rf /var/lib/apt/lists/*
18
-
19
- # WP-CLI (not included in the base image)
20
- RUN curl -fsSL -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
21
- && chmod +x /usr/local/bin/wp \
22
- && wp --info
23
-
24
- USER docker
@@ -1,23 +0,0 @@
1
- server {
2
- listen 80;
3
- root /workspace/wp;
4
- index index.php;
5
-
6
- client_max_body_size 64M;
7
-
8
- location / {
9
- try_files $uri $uri/ /index.php$is_args$args;
10
- }
11
-
12
- location ~ \.php$ {
13
- fastcgi_pass app:9000;
14
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
15
- include fastcgi_params;
16
- fastcgi_read_timeout 120;
17
- }
18
-
19
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
20
- expires max;
21
- log_not_found off;
22
- }
23
- }
@@ -1,23 +0,0 @@
1
- server {
2
- listen 80;
3
- root /workspace/wp;
4
- index index.php;
5
-
6
- client_max_body_size 64M;
7
-
8
- location / {
9
- try_files $uri $uri/ /index.php$is_args$args;
10
- }
11
-
12
- location ~ \.php$ {
13
- fastcgi_pass app:9000;
14
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
15
- include fastcgi_params;
16
- fastcgi_read_timeout 120;
17
- }
18
-
19
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
20
- expires max;
21
- log_not_found off;
22
- }
23
- }
@@ -1,29 +0,0 @@
1
- {
2
- "name": "{{projectName}} Devcontainer",
3
- "dockerComposeFile": [
4
- "docker-compose.yml"
5
- ],
6
- "service": "app",
7
- "workspaceFolder": "/workspace",
8
- "postCreateCommand": "bash .devcontainer/setup.sh",
9
- "customizations": {
10
- "vscode": {
11
- "extensions": [
12
- "bmewburn.vscode-intelephense-client",
13
- "carthage-software.mago",
14
- "oxc.oxc-vscode",
15
- "ms-azuretools.vscode-docker"
16
- ],
17
- "settings": {
18
- "editor.formatOnSave": false,
19
- "terminal.integrated.defaultProfile.linux": "bash"
20
- }
21
- }
22
- },
23
- "forwardPorts": [
24
- 8080,
25
- 3307,
26
- 6380,
27
- 5173
28
- ]
29
- }
@@ -1,76 +0,0 @@
1
- services:
2
- app:
3
- build:
4
- context: ..
5
- dockerfile: .devcontainer/Dockerfile
6
- # Force linux/amd64 for Apple Silicon (ARM) compatibility via Rosetta 2.
7
- # Remove this line if the base image gains a native linux/arm64 variant.
8
- platform: linux/amd64
9
- container_name: {{projectName}}-app
10
- working_dir: /workspace
11
- env_file:
12
- - ../.env
13
- volumes:
14
- - ..:/workspace:cached
15
- environment:
16
- WORDPRESS_DB_HOST: db
17
- WORDPRESS_DB_USER: wordpress
18
- WORDPRESS_DB_PASSWORD: wordpress
19
- WORDPRESS_DB_NAME: wordpress
20
- depends_on:
21
- db:
22
- condition: service_healthy
23
- redis:
24
- condition: service_started
25
- networks:
26
- - wp
27
-
28
- web:
29
- image: nginx:alpine
30
- container_name: {{projectName}}-web
31
- ports:
32
- - "8080:80"
33
- - "5173:5173"
34
- volumes:
35
- - ..:/workspace:ro
36
- - ./.devcontainer/config/nginx.conf:/etc/nginx/conf.d/default.conf:ro
37
- depends_on:
38
- - app
39
- networks:
40
- - wp
41
-
42
- db:
43
- image: mariadb:11
44
- container_name: {{projectName}}-db
45
- restart: unless-stopped
46
- environment:
47
- MYSQL_DATABASE: wordpress
48
- MYSQL_USER: wordpress
49
- MYSQL_PASSWORD: wordpress
50
- MYSQL_ROOT_PASSWORD: root
51
- ports:
52
- - "3307:3306"
53
- volumes:
54
- - db-data:/var/lib/mysql
55
- networks:
56
- - wp
57
- healthcheck:
58
- test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
59
- timeout: 20s
60
- retries: 10
61
-
62
- redis:
63
- image: redis:7-alpine
64
- container_name: {{projectName}}-redis
65
- restart: unless-stopped
66
- ports:
67
- - "6380:6379"
68
- networks:
69
- - wp
70
-
71
- networks:
72
- wp:
73
- driver: bridge
74
-
75
- volumes:
76
- db-data:
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Devcontainer post-create setup — runs once after the container is created.
3
- # Delegates to unified scripts so Lando, CI/CD and devcontainer share the same logic.
4
- set -euo pipefail
5
-
6
- git config --global --add safe.directory /workspace || true
7
-
8
- PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.."; pwd)"
9
-
10
- bash "${PROJECT_ROOT}/server/cmd/setup-php.sh"
11
- bash "${PROJECT_ROOT}/server/cmd/setup-node.sh"
12
-
13
- if command -v wp >/dev/null 2>&1; then
14
- bash "${PROJECT_ROOT}/server/cmd/install-wp.sh"
15
- fi
16
-
17
- echo "Devcontainer setup completed."
@@ -1,8 +0,0 @@
1
- {
2
- "http-basic": {
3
- "connect.advancedcustomfields.com": {
4
- "username": "{{acf_license_key}}",
5
- "password": "{{acf_site_url}}"
6
- }
7
- }
8
- }