@codigodoleo/wp-kit 5.0.2 → 5.2.0

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 (62) hide show
  1. package/lib/commands/init.js +87 -78
  2. package/lib/config/versions.js +45 -45
  3. package/lib/core/infer-ci-capabilities.js +39 -26
  4. package/lib/prompts/index.js +118 -92
  5. package/modules/blank-theme/index.js +23 -34
  6. package/modules/blank-theme/prompts.js +9 -25
  7. package/modules/blank-theme/templates/.lando.yml.hbs +5 -8
  8. package/modules/blank-theme/templates/package.json.hbs +1 -1
  9. package/modules/deploy/index.js +51 -61
  10. package/modules/deploy/prompts.js +36 -12
  11. package/modules/deploy/templates/.github/workflows/ci.yml.hbs +356 -63
  12. package/modules/deploy/templates/.gitlab/ci/lint-blank-theme.yml.hbs +4 -4
  13. package/modules/deploy/templates/.gitlab/ci/lint-mu-plugin.yml.hbs +3 -2
  14. package/modules/deploy/templates/.gitlab/ci/lint-plugin.yml.hbs +3 -2
  15. package/modules/deploy/templates/.gitlab/ci/lint-sage.yml.hbs +17 -14
  16. package/modules/docs/templates/docs/Infraestrutura.md.hbs +24 -0
  17. package/modules/docs/templates/docs/Troubleshooting.md.hbs +17 -0
  18. package/modules/git/.lintstagedrc.json +2 -5
  19. package/modules/lint/.oxlintrc.json +19 -0
  20. package/modules/lint/.prettierignore +16 -1
  21. package/modules/lint/index.js +32 -40
  22. package/modules/lint/templates/mago.toml.hbs +83 -0
  23. package/modules/lint/templates/package.json.hbs +6 -10
  24. package/modules/lint/templates/workspace.json.hbs +2 -36
  25. package/modules/mu-plugin/index.js +39 -51
  26. package/modules/mu-plugin/prompts.js +10 -28
  27. package/modules/mu-plugin/templates/.lando.yml.hbs +8 -10
  28. package/modules/mu-plugin/templates/acorn/composer.json.hbs +6 -5
  29. package/modules/mu-plugin/templates/composer.json.hbs +4 -2
  30. package/modules/php/templates/.lando.yml.hbs +13 -8
  31. package/modules/php/templates/composer.json.hbs +15 -7
  32. package/modules/php/templates/workspace.json.hbs +22 -19
  33. package/modules/plugin/index.js +10 -18
  34. package/modules/plugin/prompts.js +5 -19
  35. package/modules/plugin/templates/.lando.yml.hbs +8 -10
  36. package/modules/plugin/templates/composer.json.hbs +4 -2
  37. package/modules/sage/index.js +78 -88
  38. package/modules/sage/prompts.js +10 -24
  39. package/modules/sage/templates/.lando.yml.hbs +17 -7
  40. package/modules/sage/templates/theme/composer.json.hbs +36 -23
  41. package/modules/sage/templates/theme/package.json.hbs +24 -13
  42. package/modules/test/templates/composer.json.hbs +1 -1
  43. package/package.json +30 -35
  44. package/templates/.devcontainer/devcontainer.json.hbs +2 -2
  45. package/templates/.env.hbs +5 -0
  46. package/templates/.gitignore.hbs +1 -0
  47. package/templates/auth.json.hbs +8 -0
  48. package/templates/composer.json.hbs +13 -5
  49. package/templates/package.json.hbs +2 -4
  50. package/templates/workspace.json.hbs +3 -4
  51. package/wp-config.php +5 -0
  52. package/modules/blank-theme/lint/eslint.config.mjs +0 -30
  53. package/modules/blank-theme/lint/pint.json +0 -11
  54. package/modules/deploy/.github/workflows/deploy-docker.yml +0 -104
  55. package/modules/deploy/.github/workflows/deploy-ssh.yml +0 -128
  56. package/modules/deploy/.github/workflows/release.yml +0 -57
  57. package/modules/mu-plugin/lint/eslint.config.mjs +0 -30
  58. package/modules/mu-plugin/lint/pint.json +0 -11
  59. package/modules/plugin/lint/eslint.config.mjs +0 -30
  60. package/modules/plugin/lint/pint.json +0 -11
  61. package/modules/sage/lint/eslint.config.mjs +0 -30
  62. package/modules/sage/lint/pint.json +0 -11
@@ -1,77 +1,370 @@
1
- # 🚀 WordPress CI (GitHub Actions) name: CI on: push: branches: [ main, develop, staging ]
2
- pull_request: branches: [ main, develop, staging ] jobs: build-basic: name: Build basic runs-on:
3
- ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node uses:
4
- actions/setup-node@v4 with: node-version: ${{'{{'}}
5
- env.NODE_VERSION
6
- {{'}}'}}
7
- - name: Install deps (if present) run: | if [ -f package.json ]; then npm ci; fi
8
-
9
- {{#if ci.build.composer}}
10
- build-composer: name: Build Composer runs-on: ubuntu-latest steps: - name: Checkout uses:
11
- actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{'{{'}}
12
- env.PHP_VERSION
13
- {{'}}'}}
14
- - name: Install Composer deps run: | if [ -f composer.json ]; then composer install --no-dev
15
- --optimize-autoloader; fi
1
+ # CI — {{projectName}}
2
+ #
3
+ # Quality gate and deploy pipeline using hekivo/gha-workflows shared actions.
4
+ # Deploy jobs resolve secrets via a 1Password Service Account (single repo
5
+ # secret: OP_SERVICE_ACCOUNT_TOKEN). The quality job keeps org-level Connect
6
+ # (org secret OP_CONNECT_TOKEN — contract of quality.yml@v1). Update the
7
+ # op:// paths below to match your project's vault items before first run.
8
+
9
+ name: CI
10
+
11
+ on:
12
+ push:
13
+ branches: [main, staging]
14
+ pull_request:
15
+ branches: [main, staging]
16
+ workflow_dispatch:
17
+ inputs:
18
+ deploy:
19
+ description: "Run deploy after build"
20
+ required: false
21
+ type: boolean
22
+ default: false
23
+ {{#if ci.deploy.ssh}}
24
+ deploy-environment:
25
+ description: "Target environment when deploy=true"
26
+ required: false
27
+ type: choice
28
+ options:
29
+ - staging
30
+ - production
31
+ default: staging
32
+ {{/if}}
33
+
34
+ permissions:
35
+ contents: read
36
+ {{#if ci.deploy.docker}}
37
+ packages: write
16
38
  {{/if}}
17
39
 
40
+ concurrency:
41
+ group: ci-$\{{ github.ref }}
42
+ cancel-in-progress: true
43
+
44
+ env:
45
+ PHP_VERSION: "{{phpVersion}}"
46
+ NODE_VERSION: "{{nodeVersion}}"
18
47
  {{#if ci.build.sage}}
19
- build-sage: name: Build Sage Theme runs-on: ubuntu-latest steps: - name: Checkout uses:
20
- actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{'{{'}}
21
- env.NODE_VERSION
22
- {{'}}'}}
23
- - name: Build theme run: | THEME="{{ci.theme.paths.themeRoot}}" if [ -d "$THEME" ]; then cd
24
- "$THEME" if [ -f package.json ]; then npm ci; fi if [ -f yarn.lock ]; then yarn install
25
- --frozen-lockfile; fi if [ -f package.json ]; then npm run build || yarn build; fi else echo "Tema
26
- não encontrado em $THEME — pulando build do tema" fi
48
+ THEME_PATH: {{ci.theme.paths.themeRoot}}
27
49
  {{/if}}
50
+ # Disable husky in CI — no human commits, and semantic-release's auto-commit
51
+ # (chore(release): vX.Y.Z [skip ci]) would trip the commitlint hook.
52
+ # https://typioca.github.io/husky/how-to.html#ci-server-and-docker
53
+ HUSKY: "0"
28
54
 
29
- {{#if ci.lint.sage}}
30
- lint-sage: name: Lint Sage Theme runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{'{{'}}
31
- env.NODE_VERSION
32
- {{'}}'}}
33
- - name: Lint Sage run: | cd {{ci.theme.paths.themeRoot}} && npm ci && npx eslint resources/ --config eslint.config.mjs --fix-dry-run && npx stylelint "resources/**/*.{css,scss}"
55
+ jobs:
56
+ # ── Quality Gate ────────────────────────────────────────────────────────────
57
+ quality:
58
+ uses: hekivo/gha-workflows/.github/workflows/quality.yml@v1
59
+ with:
60
+ php-version: "{{phpVersion}}"
61
+ node-version: "{{nodeVersion}}"
62
+ {{#if ci.build.sage}}
63
+ theme-path: {{ci.theme.paths.themeRoot}}
64
+ {{/if}}
65
+ mago-lint-continue-on-error: false
66
+ secrets:
67
+ # org-level Connect (ACF no quality) — deploys usam SA-mode
68
+ OP_CONNECT_TOKEN: $\{{ secrets.OP_CONNECT_TOKEN }}
69
+ {{#if enable_acf_pro}}
70
+ ACF_CONNECT_USERNAME: $\{{ secrets.ACF_CONNECT_USERNAME }}
71
+ ACF_CONNECT_PASSWORD: $\{{ secrets.ACF_CONNECT_PASSWORD }}
72
+ {{/if}}
73
+
74
+ {{#if ci.deploy.docker}}
75
+ # ── Docker Build ─────────────────────────────────────────────────────────────
76
+ docker-build:
77
+ needs: quality
78
+ uses: hekivo/gha-workflows/.github/workflows/docker-build.yml@v1
79
+ with:
80
+ image-name: $\{{ github.repository }}
81
+ platforms: linux/amd64
82
+ permissions:
83
+ packages: write
84
+ contents: read
85
+
86
+ # ── Docker Publish ────────────────────────────────────────────────────────────
87
+ docker-publish:
88
+ needs: docker-build
89
+ if: |
90
+ github.event_name == 'push' ||
91
+ (github.event_name == 'workflow_dispatch' && inputs.deploy == true)
92
+ uses: hekivo/gha-workflows/.github/workflows/docker-publish.yml@v1
93
+ with:
94
+ source-image: $\{{ needs.docker-build.outputs.image-ref }}
95
+ registry-type: {{docker_registry}}
96
+ image-name: $\{{ github.repository }}
97
+ image-tag: $\{{ github.ref_name }}
98
+ {{#if ci.docker.registryEcr}}
99
+ aws-region: us-east-1 # TODO: update region
100
+ ecr-registry: "" # TODO: 123456789012.dkr.ecr.us-east-1.amazonaws.com
101
+ {{/if}}
102
+ {{#if ci.docker.registryDockerHub}}
103
+ dockerhub-username: "" # TODO: set your Docker Hub username
104
+ {{/if}}
105
+ {{#if ci.docker.registryGitlab}}
106
+ gitlab-registry: registry.gitlab.com # TODO: update if self-hosted
107
+ {{/if}}
108
+ secrets:
109
+ {{#if ci.docker.registryEcr}}
110
+ AWS_ROLE_ARN: $\{{ secrets.AWS_ROLE_ARN }}
34
111
  {{/if}}
112
+ {{#if ci.docker.registryDockerHub}}
113
+ DOCKERHUB_TOKEN: $\{{ secrets.DOCKERHUB_TOKEN }}
114
+ {{/if}}
115
+ {{#if ci.docker.registryGitlab}}
116
+ GITLAB_REGISTRY_TOKEN: $\{{ secrets.GITLAB_REGISTRY_TOKEN }}
117
+ {{/if}}
118
+ permissions:
119
+ packages: read
120
+ contents: read
121
+ id-token: write
122
+ {{/if}}
123
+
124
+ {{#if ci.deploy.ssh}}
125
+ # ── Deploy Staging ───────────────────────────────────────────────────────────
126
+ deploy-staging:
127
+ needs: quality
128
+ runs-on: ubuntu-latest
129
+ environment: staging
130
+ if: |
131
+ (github.event_name == 'workflow_dispatch' && inputs.deploy == true && inputs['deploy-environment'] == 'staging') ||
132
+ (github.event_name == 'push' && github.ref == 'refs/heads/staging')
35
133
 
36
- {{#if ci.lint.mu_plugin}}
37
- lint-mu-plugin: name: Lint MU Plugin runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{'{{'}}
38
- env.PHP_VERSION
39
- {{'}}'}}
40
- - name: Lint MU Plugin PHP run: | cd content/mu-plugins/{{mu_plugin_name}} && composer install --no-dev && ./vendor/bin/pint --test
134
+ steps:
135
+ - name: Checkout
136
+ uses: actions/checkout@v4
137
+
138
+ - name: Load secrets from 1Password
139
+ uses: 1password/load-secrets-action@v4
140
+ with:
141
+ export-env: true
142
+ env:
143
+ OP_SERVICE_ACCOUNT_TOKEN: $\{{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
144
+ {{#if enable_acf_pro}}
145
+ # ACF Pro Composer auth — item shared across all projects in Hekivo-Internal
146
+ ACF_CONNECT_USERNAME: op://Hekivo-Internal/hekivo-acf-connect/username
147
+ ACF_CONNECT_PASSWORD: op://Hekivo-Internal/hekivo-acf-connect/password
148
+ {{/if}}
149
+ # SSH transport credentials — update vault/item paths for this project
150
+ SSH_HOST: op://Client-{{projectName}}/ssh-staging/hostname
151
+ SSH_USER: op://Client-{{projectName}}/ssh-staging/username
152
+ SSH_REMOTE_PATH: op://Client-{{projectName}}/ssh-staging/remote-path
153
+ SSH_PRIVATE_KEY: op://Client-{{projectName}}/staging-ssh-key/private_key?ssh-format=openssh
154
+ {{#if ci.ssh.useCloudflare}}
155
+ # Cloudflare Access Service Token for SSH tunnel (staging) — shared item in Hekivo-Internal
156
+ TUNNEL_SERVICE_TOKEN_ID: op://Hekivo-Internal/prod-cf-access-gha-deploy-staging/client-id
157
+ TUNNEL_SERVICE_TOKEN_SECRET: op://Hekivo-Internal/prod-cf-access-gha-deploy-staging/client-secret
41
158
  {{/if}}
159
+ # .env composition (3 layers: template + salts + DB)
160
+ ENV_TEMPLATE: op://Client-{{projectName}}/staging-env-file/notesPlain
161
+ WP_SALTS_BLOCK: op://Client-{{projectName}}/wp-salts/notesPlain
162
+ WORDPRESS_DB_NAME: op://Client-{{projectName}}/staging-wp-database/database
163
+ WORDPRESS_DB_USER: op://Client-{{projectName}}/staging-wp-database/username
164
+ WORDPRESS_DB_PASSWORD: op://Client-{{projectName}}/staging-wp-database/password
165
+ WORDPRESS_DB_HOST: op://Client-{{projectName}}/staging-wp-database/hostname
166
+ WORDPRESS_DB_PORT: op://Client-{{projectName}}/staging-wp-database/port
167
+ # Cloudflare cache purge — shared item in Hekivo-Internal
168
+ CLOUDFLARE_PURGE_ZONE_ID: op://Hekivo-Internal/prod-cloudflare-api/zone id
169
+ CLOUDFLARE_PURGE_TOKEN: op://Hekivo-Internal/prod-cloudflare-api/credential
42
170
 
43
- {{#if ci.lint.plugin}}
44
- lint-plugin: name: Lint Plugin runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{'{{'}}
45
- env.PHP_VERSION
46
- {{'}}'}}
47
- - name: Lint Plugin PHP run: | cd content/plugins/{{plugin_name}} && composer install --no-dev && ./vendor/bin/pint --test
171
+ - name: Setup WordPress (production deps)
172
+ uses: hekivo/gha-workflows/actions/setup-wordpress@v1
173
+ with:
174
+ php-version: $\{{ env.PHP_VERSION }}
175
+ no-dev: "true"
176
+ {{#if ci.build.sage}}
177
+ working-dir: $\{{ env.THEME_PATH }}
178
+ {{/if}}
179
+ {{#if enable_acf_pro}}
180
+ acf-username: $\{{ env.ACF_CONNECT_USERNAME }}
181
+ acf-password: $\{{ env.ACF_CONNECT_PASSWORD }}
48
182
  {{/if}}
49
183
 
50
- {{#if ci.lint.blank_theme}}
51
- lint-blank-theme: name: Lint Blank Theme runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{'{{'}}
52
- env.NODE_VERSION
53
- {{'}}'}}
54
- - name: Lint Blank Theme run: | cd content/themes/{{blank_theme_name}} && npm ci && npx eslint src/js/ --config eslint.config.mjs --fix-dry-run && npx stylelint "src/scss/**/*.scss"
184
+ {{#if ci.build.sage}}
185
+ - name: Setup Node.js + theme
186
+ uses: hekivo/gha-workflows/actions/setup-node-theme@v1
187
+ with:
188
+ node-version: $\{{ env.NODE_VERSION }}
189
+ install-root: "false"
190
+ theme-path: $\{{ env.THEME_PATH }}
191
+
192
+ - name: Build theme assets
193
+ run: npm run build --prefix "$\{{ env.THEME_PATH }}"
194
+
55
195
  {{/if}}
196
+ - name: Compose .env
197
+ uses: hekivo/gha-workflows/actions/compose-dotenv@v1
198
+ with:
199
+ env-template: $\{{ env.ENV_TEMPLATE }}
200
+ wp-salts: $\{{ env.WP_SALTS_BLOCK }}
201
+ db-name: $\{{ env.WORDPRESS_DB_NAME }}
202
+ db-user: $\{{ env.WORDPRESS_DB_USER }}
203
+ db-password: $\{{ env.WORDPRESS_DB_PASSWORD }}
204
+ db-host: $\{{ env.WORDPRESS_DB_HOST }}
205
+ db-port: $\{{ env.WORDPRESS_DB_PORT }}
56
206
 
57
- test-basic: name: Tests runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 -
58
- name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{'{{'}}
59
- env.NODE_VERSION
60
- {{'}}'}}
61
- - name: Run basic tests run: echo "No tests yet"
207
+ {{#if ci.ssh.useCloudflare}}
208
+ - name: Setup SSH via Cloudflare Tunnel
209
+ uses: hekivo/gha-workflows/actions/setup-cloudflare-ssh@v1
210
+ with:
211
+ ssh-host: $\{{ env.SSH_HOST }}
212
+ ssh-user: $\{{ env.SSH_USER }}
213
+ ssh-private-key: $\{{ env.SSH_PRIVATE_KEY }}
214
+ tunnel-token-id: $\{{ env.TUNNEL_SERVICE_TOKEN_ID }}
215
+ tunnel-token-secret: $\{{ env.TUNNEL_SERVICE_TOKEN_SECRET }}
216
+ {{else}}
217
+ - name: Configure SSH agent
218
+ uses: webfactory/ssh-agent@v0.9.0
219
+ with:
220
+ ssh-private-key: $\{{ env.SSH_PRIVATE_KEY }}
62
221
 
63
- {{#if ci.deploy.docker}}
64
- deploy-docker: if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' name:
65
- Deploy Docker runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set
66
- up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GHCR uses:
67
- docker/login-action@v3 with: registry: ghcr.io username: ${{'{{'}}
68
- github.actor
69
- {{'}}'}}
70
- password: ${{'{{'}}
71
- secrets.GITHUB_TOKEN
72
- {{'}}'}}
73
- - name: Build (placeholder) run: echo "Deploy Docker"
74
- {{/if}}
75
-
76
- env: PHP_VERSION: "{{phpVersion}}" NODE_VERSION: "{{ci.nodeVersion}}" WORDPRESS_VERSION: "{{wpCoreVersion}}"
77
- PROJECT_NAME: "{{projectName}}"
222
+ - name: Add known hosts
223
+ run: |
224
+ mkdir -p ~/.ssh
225
+ ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
226
+ chmod 600 ~/.ssh/known_hosts
227
+ {{/if}}
228
+
229
+ - name: Deploy via rsync
230
+ uses: hekivo/gha-workflows/actions/deploy-rsync@v1
231
+ with:
232
+ ssh-target: $\{{ env.SSH_HOST }}
233
+ remote-root: $\{{ env.SSH_REMOTE_PATH }}
234
+ {{#if ci.build.sage}}
235
+ theme-slug: {{projectName}}
236
+ {{/if}}
237
+
238
+ - name: WordPress post-deploy
239
+ uses: hekivo/gha-workflows/actions/wp-post-deploy@v1
240
+ with:
241
+ ssh-target: $\{{ env.SSH_HOST }}
242
+ remote-root: $\{{ env.SSH_REMOTE_PATH }}
243
+ {{#if enable_acf_pro}}
244
+ plugin-slug: advanced-custom-fields-pro
245
+ {{/if}}
246
+ {{#if ci.build.sage}}
247
+ theme-slug: {{projectName}}
248
+ {{/if}}
249
+
250
+ - name: Purge Cloudflare cache
251
+ uses: hekivo/gha-workflows/actions/cloudflare-purge@v1
252
+ with:
253
+ zone-id: $\{{ env.CLOUDFLARE_PURGE_ZONE_ID }}
254
+ api-token: $\{{ env.CLOUDFLARE_PURGE_TOKEN }}
255
+
256
+ # ── Deploy Production ─────────────────────────────────────────────────────────
257
+ deploy-production:
258
+ needs: quality
259
+ runs-on: ubuntu-latest
260
+ environment: production
261
+ if: |
262
+ (github.event_name == 'workflow_dispatch' && inputs.deploy == true && inputs['deploy-environment'] == 'production') ||
263
+ (github.event_name == 'push' && github.ref == 'refs/heads/main')
264
+
265
+ steps:
266
+ - name: Checkout
267
+ uses: actions/checkout@v4
268
+
269
+ - name: Load secrets from 1Password
270
+ uses: 1password/load-secrets-action@v4
271
+ with:
272
+ export-env: true
273
+ env:
274
+ OP_SERVICE_ACCOUNT_TOKEN: $\{{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
275
+ {{#if enable_acf_pro}}
276
+ ACF_CONNECT_USERNAME: op://Hekivo-Internal/{{projectName}}-acf-connect/username
277
+ ACF_CONNECT_PASSWORD: op://Hekivo-Internal/{{projectName}}-acf-connect/password
278
+ {{/if}}
279
+ SSH_HOST: op://Client-{{projectName}}/ssh-production/hostname
280
+ SSH_USER: op://Client-{{projectName}}/ssh-production/username
281
+ SSH_PORT: op://Client-{{projectName}}/ssh-production/port
282
+ SSH_REMOTE_PATH: op://Client-{{projectName}}/ssh-production/remote-path
283
+ SSH_PRIVATE_KEY: op://Client-{{projectName}}/production-server-ssh-key/private_key?ssh-format=openssh
284
+ ENV_TEMPLATE: op://Client-{{projectName}}/production-env-file/notesPlain
285
+ WP_SALTS_BLOCK: op://Client-{{projectName}}/wp-salts/notesPlain
286
+ WORDPRESS_DB_NAME: op://Client-{{projectName}}/production-wp-database/database
287
+ WORDPRESS_DB_USER: op://Client-{{projectName}}/production-wp-database/username
288
+ WORDPRESS_DB_PASSWORD: op://Client-{{projectName}}/production-wp-database/password
289
+ WORDPRESS_DB_HOST: op://Client-{{projectName}}/production-wp-database/hostname
290
+ WORDPRESS_DB_PORT: op://Client-{{projectName}}/production-wp-database/port
291
+ CLOUDFLARE_PURGE_ZONE_ID: op://Hekivo-Internal/{{projectName}}-cloudflare-api/zone id
292
+ CLOUDFLARE_PURGE_TOKEN: op://Hekivo-Internal/{{projectName}}-cloudflare-api/credential
293
+
294
+ - name: Setup WordPress (production deps)
295
+ uses: hekivo/gha-workflows/actions/setup-wordpress@v1
296
+ with:
297
+ php-version: $\{{ env.PHP_VERSION }}
298
+ no-dev: "true"
299
+ {{#if ci.build.sage}}
300
+ working-dir: $\{{ env.THEME_PATH }}
301
+ {{/if}}
302
+ {{#if enable_acf_pro}}
303
+ acf-username: $\{{ env.ACF_CONNECT_USERNAME }}
304
+ acf-password: $\{{ env.ACF_CONNECT_PASSWORD }}
305
+ {{/if}}
306
+
307
+ {{#if ci.build.sage}}
308
+ - name: Setup Node.js + theme
309
+ uses: hekivo/gha-workflows/actions/setup-node-theme@v1
310
+ with:
311
+ node-version: $\{{ env.NODE_VERSION }}
312
+ install-root: "false"
313
+ theme-path: $\{{ env.THEME_PATH }}
314
+
315
+ - name: Build theme assets
316
+ run: npm run build --prefix "$\{{ env.THEME_PATH }}"
317
+
318
+ {{/if}}
319
+ - name: Compose .env
320
+ uses: hekivo/gha-workflows/actions/compose-dotenv@v1
321
+ with:
322
+ env-template: $\{{ env.ENV_TEMPLATE }}
323
+ wp-salts: $\{{ env.WP_SALTS_BLOCK }}
324
+ db-name: $\{{ env.WORDPRESS_DB_NAME }}
325
+ db-user: $\{{ env.WORDPRESS_DB_USER }}
326
+ db-password: $\{{ env.WORDPRESS_DB_PASSWORD }}
327
+ db-host: $\{{ env.WORDPRESS_DB_HOST }}
328
+ db-port: $\{{ env.WORDPRESS_DB_PORT }}
329
+
330
+ - name: Configure SSH agent
331
+ uses: webfactory/ssh-agent@v0.9.0
332
+ with:
333
+ ssh-private-key: $\{{ env.SSH_PRIVATE_KEY }}
334
+
335
+ - name: Add known hosts
336
+ run: |
337
+ PORT="${SSH_PORT:-22}"
338
+ mkdir -p ~/.ssh
339
+ ssh-keyscan -p "$PORT" -H "$SSH_HOST" >> ~/.ssh/known_hosts
340
+ chmod 600 ~/.ssh/known_hosts
341
+
342
+ - name: Deploy via rsync
343
+ uses: hekivo/gha-workflows/actions/deploy-rsync@v1
344
+ with:
345
+ ssh-target: $\{{ env.SSH_USER }}@$\{{ env.SSH_HOST }}
346
+ ssh-cmd: ssh -p $\{{ env.SSH_PORT || '22' }}
347
+ remote-root: $\{{ env.SSH_REMOTE_PATH }}
348
+ {{#if ci.build.sage}}
349
+ theme-slug: {{projectName}}
350
+ {{/if}}
351
+
352
+ - name: WordPress post-deploy
353
+ uses: hekivo/gha-workflows/actions/wp-post-deploy@v1
354
+ with:
355
+ ssh-target: $\{{ env.SSH_USER }}@$\{{ env.SSH_HOST }}
356
+ ssh-cmd: ssh -p $\{{ env.SSH_PORT || '22' }}
357
+ remote-root: $\{{ env.SSH_REMOTE_PATH }}
358
+ {{#if enable_acf_pro}}
359
+ plugin-slug: advanced-custom-fields-pro
360
+ {{/if}}
361
+ {{#if ci.build.sage}}
362
+ theme-slug: {{projectName}}
363
+ {{/if}}
364
+
365
+ - name: Purge Cloudflare cache
366
+ uses: hekivo/gha-workflows/actions/cloudflare-purge@v1
367
+ with:
368
+ zone-id: $\{{ env.CLOUDFLARE_PURGE_ZONE_ID }}
369
+ api-token: $\{{ env.CLOUDFLARE_PURGE_TOKEN }}
370
+ {{/if}}
@@ -1,5 +1,5 @@
1
1
  {{#if ci.lint.blank_theme}}
2
- lint:blank-theme:eslint:
2
+ lint:blank-theme:js:
3
3
  stage: lint
4
4
  image: node:${NODE_VERSION}-alpine
5
5
  variables:
@@ -7,9 +7,9 @@ lint:blank-theme:eslint:
7
7
  before_script:
8
8
  - apk add --no-cache git
9
9
  script:
10
- - cd $THEME_DIR
11
- - npm ci --cache .npm --prefer-offline
12
- - npx eslint src/js/ --config eslint.config.mjs --fix-dry-run
10
+ - npm ci
11
+ - npx oxfmt --check
12
+ - npx oxlint
13
13
  rules:
14
14
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
15
15
  - if: $CI_COMMIT_BRANCH == "main"
@@ -1,5 +1,5 @@
1
1
  {{#if ci.lint.mu_plugin}}
2
- lint:mu-plugin:pint:
2
+ lint:mu-plugin:quality:
3
3
  stage: lint
4
4
  image: php:${PHP_VERSION}-cli
5
5
  variables:
@@ -10,7 +10,8 @@ lint:mu-plugin:pint:
10
10
  script:
11
11
  - cd $PLUGIN_DIR
12
12
  - composer install --no-dev
13
- - ./vendor/bin/pint --test
13
+ - vendor/bin/mago format --check
14
+ - vendor/bin/mago lint
14
15
  rules:
15
16
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
16
17
  - if: $CI_COMMIT_BRANCH == "main"
@@ -1,5 +1,5 @@
1
1
  {{#if ci.lint.plugin}}
2
- lint:plugin:pint:
2
+ lint:plugin:quality:
3
3
  stage: lint
4
4
  image: php:${PHP_VERSION}-cli
5
5
  variables:
@@ -10,7 +10,8 @@ lint:plugin:pint:
10
10
  script:
11
11
  - cd $PLUGIN_DIR
12
12
  - composer install --no-dev
13
- - ./vendor/bin/pint --test
13
+ - vendor/bin/mago format --check
14
+ - vendor/bin/mago lint
14
15
  rules:
15
16
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
16
17
  - if: $CI_COMMIT_BRANCH == "main"
@@ -1,44 +1,47 @@
1
1
  {{#if ci.lint.sage}}
2
- lint:sage:eslint:
2
+ lint:sage:quality:
3
3
  stage: lint
4
- image: node:${NODE_VERSION}-alpine
4
+ image: php:${PHP_VERSION}-cli
5
5
  before_script:
6
- - apk add --no-cache git
6
+ - apt-get update -qq && apt-get install -qq --no-install-recommends git unzip
7
+ - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
7
8
  script:
8
- - cd {{ci.theme.paths.themeRoot}}
9
- - npm ci --cache .npm --prefer-offline
10
- - npx eslint resources/ --config eslint.config.mjs --fix-dry-run
9
+ - composer install --no-dev --optimize-autoloader
10
+ - vendor/bin/mago format --check
11
+ - vendor/bin/mago lint
11
12
  rules:
12
13
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
13
14
  - if: $CI_COMMIT_BRANCH == "main"
14
15
  - if: $CI_COMMIT_BRANCH == "staging"
15
16
  - if: $CI_COMMIT_BRANCH == "develop"
16
17
 
17
- lint:sage:stylelint:
18
+ lint:sage:js:
18
19
  stage: lint
19
20
  image: node:${NODE_VERSION}-alpine
20
21
  before_script:
21
22
  - apk add --no-cache git
22
23
  script:
24
+ - npm ci
25
+ - npx oxfmt --check
26
+ - npx oxlint
23
27
  - cd {{ci.theme.paths.themeRoot}}
24
28
  - npm ci --cache .npm --prefer-offline
25
- - npx stylelint "resources/**/*.{css,scss}"
29
+ - npm run build
26
30
  rules:
27
31
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
28
32
  - if: $CI_COMMIT_BRANCH == "main"
29
33
  - if: $CI_COMMIT_BRANCH == "staging"
30
34
  - if: $CI_COMMIT_BRANCH == "develop"
31
35
 
32
- lint:sage:pint:
36
+ lint:sage:stylelint:
33
37
  stage: lint
34
- image: php:${PHP_VERSION}-cli
38
+ image: node:${NODE_VERSION}-alpine
35
39
  before_script:
36
- - apt-get update -qq && apt-get install -qq --no-install-recommends git unzip
37
- - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
40
+ - apk add --no-cache git
38
41
  script:
39
42
  - cd {{ci.theme.paths.themeRoot}}
40
- - composer install --no-dev --optimize-autoloader
41
- - ./vendor/bin/pint --test
43
+ - npm ci --cache .npm --prefer-offline
44
+ - npx stylelint "resources/**/*.{css,scss}"
42
45
  rules:
43
46
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
44
47
  - if: $CI_COMMIT_BRANCH == "main"
@@ -41,6 +41,30 @@ hours during incidents.
41
41
  - **TLS certificate management**: `{{ "{{TODO: ACM / Let's Encrypt / Cloudflare}}" }}`
42
42
  - **WAF**: `{{ "{{TODO}}" }}`
43
43
 
44
+ ## WordPress cron (production)
45
+
46
+ Default WP-Cron fires via an HTTP *loopback* to `/wp/wp-cron.php`. When the site sits
47
+ behind an edge authentication layer (e.g. **Cloudflare Access / Zero Trust**), that
48
+ loopback is redirected to the login page and **never executes** — so no scheduled event
49
+ runs (plugin caches, auto-updates, jobs), silently.
50
+
51
+ In production behind edge auth, provision **both** parts:
52
+
53
+ 1. A system cron (e.g. CloudPanel → Site → Cron Jobs) that runs WP-CLI directly, without
54
+ going through HTTP:
55
+
56
+ ```
57
+ */5 * * * * cd <htdocs> && wp cron event run --due-now --quiet
58
+ ```
59
+
60
+ 2. `WORDPRESS_DISABLE_WP_CRON=true` in the production `.env`, to stop the dead loopback.
61
+ `wp-config.php` maps each `WORDPRESS_*` var to the constant of the same name without the
62
+ prefix, so this defines `DISABLE_WP_CRON`. It must be `WORDPRESS_DISABLE_WP_CRON` — not
63
+ `WORDPRESS_DISABLE_CRON`, which would define `DISABLE_CRON` and be ignored by WordPress.
64
+
65
+ Do not enable this in the local `.env`: under Lando the loopback works and is convenient.
66
+ See [Troubleshooting](./Troubleshooting.md) for the symptom and diagnosis.
67
+
44
68
  ## Secrets and IAM
45
69
 
46
70
  - **Secrets store**: `{{ "{{TODO: cloud secret manager / Vault / env vars}}" }}`
@@ -62,4 +62,21 @@ Each entry follows the same shape:
62
62
 
63
63
  ---
64
64
 
65
+ ### Scheduled tasks never run / a plugin screen stays empty (behind edge auth)
66
+
67
+ **Symptom**: A plugin admin screen that loads data via a background refresh never populates (e.g. an items list spins or returns empty forever). More generally: any `wp_schedule_event` / WP-Cron job silently never fires in production, while the same code works under Lando.
68
+ **Likely cause**: The site is behind **Cloudflare Access** (or any edge auth fronting the whole domain). Default WP-Cron fires via a loopback HTTP request to `/wp/wp-cron.php`, which the edge `302`-redirects to its login — so `wp-cron.php` never executes and no scheduled event runs. The browser's `admin-ajax` still works (it carries the auth cookie), so the page loads but the background job never completes.
69
+ **Fix**:
70
+
71
+ 1. Add a system cron (CloudPanel → Site → Cron Jobs) running WP-CLI directly (bypasses HTTP/edge auth):
72
+ ```
73
+ */5 * * * * cd <htdocs> && wp cron event run --due-now --quiet
74
+ ```
75
+ 2. Stop the futile loopback: set `WORDPRESS_DISABLE_WP_CRON=true` in the production `.env`.
76
+ 3. One-time unblock / confirm: `wp cron event run --due-now` over SSH — pending jobs run immediately.
77
+
78
+ **Why this is the fix**: `wp cron event run` executes events in the local PHP process, never touching the public HTTP surface, so edge auth can't block it. `DISABLE_WP_CRON` only silences the dead loopback — the system cron is what runs the jobs. Confirm with `curl -I https://<domain>/wp/wp-cron.php` → `302` to the edge auth login.
79
+
80
+ ---
81
+
65
82
  `{{ "{{TODO: add project-specific entries as they come up. The list below is intentionally short — generic entries that apply to every wp-kit project.}}" }}`
@@ -1,7 +1,4 @@
1
1
  {
2
- "*.{js,jsx,ts,tsx}": "eslint",
3
- "*.{css,scss,sass}": "stylelint",
4
- "*.{json,yaml,yml,md}": "prettier --check",
5
- "*.{html}": "prettier --check --parser html",
6
- "*.{php}": "pint --test"
2
+ "*.{js,mjs,ts,vue,jsx,tsx}": ["oxfmt --write", "oxlint --fix"],
3
+ "*.{json,jsonc,html,yml,yaml,md,mdx}": ["oxfmt --write"]
7
4
  }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
3
+ "ignorePatterns": [
4
+ "node_modules/**",
5
+ "vendor/**",
6
+ "content/themes/*/public/build/**",
7
+ "content/themes/*/node_modules/**",
8
+ "content/themes/*/vendor/**",
9
+ "wp/**",
10
+ "content/plugins/**",
11
+ "content/mu-plugins/**",
12
+ "public/build/**",
13
+ "test-results/**",
14
+ "playwright-report/**"
15
+ ],
16
+ "rules": {
17
+ "no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
18
+ }
19
+ }