@codigodoleo/wp-kit 4.0.0 → 5.0.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.
@@ -1,7 +1,68 @@
1
- 1. Inside GitLab:
2
- 1. Go to [CI/CD -> Schedules]({{repositoryWebUrl}}/-/pipeline_schedules).
3
- 2. Press the play button on the `Download Prod Database` scheduled pipeline.
4
- 1. It'll create a database backup and store it in the S3 bucket.
5
- 3. After finishing the job above, press the play button on the `Replicate Production DB into Staging DB` scheduled pipeline.
6
- 1. That last job uses the database backup inside the S3 bucket
7
- 4. Done! Staging environment's updated now.
1
+ # Sync the Production DB into Staging
2
+
3
+ Refresh the **{{projectTitle}}** staging database with a recent snapshot
4
+ of production, so QA hits realistic data.
5
+
6
+ ## When to do this
7
+
8
+ - Before validating a release branch.
9
+ - After any production data migration that QA needs to test against.
10
+ - Routinely (weekly is a common cadence) so staging never drifts too far.
11
+
12
+ ## Procedure
13
+
14
+ The exact mechanism depends on how production database backups are
15
+ produced and where they live. Pick the option that matches your stack
16
+ and replace this file with the concrete steps.
17
+
18
+ ### Option A — CI-scheduled pipeline
19
+
20
+ If {{ciSystem}} runs a scheduled job that exports production and writes
21
+ it to object storage:
22
+
23
+ 1. Trigger the scheduled job that dumps production:
24
+ - {{#if isGitLab}}[CI/CD → Schedules]({{repositoryWebUrl}}/-/pipeline_schedules){{/if}}
25
+ {{#if isGitHub}}- GitHub Actions → "Run workflow" on the dump pipeline.{{/if}}
26
+ {{#if isBitbucket}}- Bitbucket Pipelines → "Run pipeline" on the schedule defined in `bitbucket-pipelines.yml`.{{/if}}
27
+ 2. Wait for the dump artefact to land in object storage.
28
+ 3. Trigger the import job that loads the artefact into the staging database.
29
+ 4. Verify in {{ciSystem}} that both jobs finished green.
30
+
31
+ `{{ "{{TODO: link the exact job names and the artefact bucket / path}}" }}`
32
+
33
+ ### Option B — Manual via WP-CLI
34
+
35
+ If there is no CI pipeline yet:
36
+
37
+ ```bash
38
+ # On a host with read access to production:
39
+ wp db export prod-dump.sql.gz --add-drop-table
40
+
41
+ # Copy the dump to a host with write access to staging:
42
+ scp prod-dump.sql.gz user@staging-host:/tmp/
43
+
44
+ # On the staging host:
45
+ wp db import /tmp/prod-dump.sql.gz
46
+ wp search-replace 'https://{{projectProductionDomain}}' 'https://{{projectStagingDomain}}'
47
+ wp cache flush
48
+ ```
49
+
50
+ `{{ "{{TODO: replace with the actual commands and hostnames used in this project}}" }}`
51
+
52
+ ## Sanitisation
53
+
54
+ Production data may contain PII the staging environment should not hold
55
+ in clear. Before importing, scrub:
56
+
57
+ - User emails (replace with `user{id}@example.test`).
58
+ - Personal addresses, phone numbers.
59
+ - Order/payment records, depending on regulatory scope.
60
+ - Any third-party tokens stored in `wp_options`.
61
+
62
+ `{{ "{{TODO: define which tables/columns get scrubbed and the SQL or WP-CLI commands that do it}}" }}`
63
+
64
+ ## After the sync
65
+
66
+ - Run a smoke test on staging.
67
+ - Notify the team in `{{ "{{TODO: incident / dev channel}}" }}` so QA knows fresh data is live.
68
+ - If anything looks wrong, restore the previous staging snapshot rather than chasing partial fixes.
@@ -1,3 +1,65 @@
1
- ### I'm having trouble accessing {{projectTitle}}'s Gitlab.
1
+ # Troubleshooting
2
2
 
3
- If you can't access {{repositoryHost}} connected to the VPN try accessing GitLab from the Google Apps menu.
3
+ Common issues and recovery steps for **{{projectTitle}}**. Add an entry
4
+ every time you debug something the next person would also stumble on.
5
+
6
+ ## Format
7
+
8
+ Each entry follows the same shape:
9
+
10
+ ```markdown
11
+ ### <Short symptom>
12
+
13
+ **Symptom**: what the user / engineer actually sees.
14
+ **Likely cause**: one or two sentences.
15
+ **Fix**: numbered, copy-pasteable steps.
16
+ **Why this is the fix**: brief, so future-you doesn't relearn it.
17
+ ```
18
+
19
+ ---
20
+
21
+ ### `lando start` fails with "port already in use"
22
+
23
+ **Symptom**: Lando fails to start with `Error starting the network: ports are not available`.
24
+ **Likely cause**: another local stack (Docker container, system service, or a previous Lando project) is bound to ports 80, 443, or 3306.
25
+ **Fix**:
26
+
27
+ 1. List Lando apps: `lando list`.
28
+ 2. Stop unrelated ones: `lando stop --name <other-app>`.
29
+ 3. If a non-Lando process holds the port: `sudo lsof -i :443` to identify it, then stop or reconfigure that service.
30
+ 4. Retry `lando start`.
31
+
32
+ **Why this is the fix**: Lando binds host ports; conflicts surface as start failures, not run failures.
33
+
34
+ ---
35
+
36
+ ### Composer install hangs or 404s on a wpackagist plugin
37
+
38
+ **Symptom**: `composer install` stalls on `wpackagist-plugin/<name>` or errors with "Could not find package".
39
+ **Likely cause**: the wpackagist mirror reflects what is on the WordPress.org plugin directory at scan time. Plugins that were removed (deprecated, taken down) won't be there even if they used to be.
40
+ **Fix**:
41
+
42
+ 1. Check the plugin's current status on https://wordpress.org/plugins/.
43
+ 2. If the plugin is gone: replace it with a maintained alternative, or vendor it via `repositories` + `type: package` in `composer.json`.
44
+ 3. If the plugin still exists upstream: clear Composer cache (`composer clear-cache`) and retry.
45
+
46
+ **Why this is the fix**: wpackagist is a mirror, not the source of truth. A 404 means upstream removed the plugin; clearing cache only helps if it's a transient mirror sync gap.
47
+
48
+ ---
49
+
50
+ ### I can't reach {{repositoryHost}}
51
+
52
+ **Symptom**: Pushes time out, the web UI is unreachable.
53
+ **Likely cause**: VPN is down, DNS is poisoned, or {{repositoryHost}} itself is having an incident.
54
+ **Fix**:
55
+
56
+ 1. Check {{repositoryHost}}'s public status page.
57
+ 2. Try reaching it without VPN if your network allows it.
58
+ 3. Try a different DNS resolver (`dig @1.1.1.1 {{repositoryHost}}`).
59
+ 4. If all else fails: stash work locally and resume when the platform recovers.
60
+
61
+ **Why this is the fix**: most outages here are platform-side or network-side, not client misconfiguration. Burning hours on local fixes when {{repositoryHost}} is down wastes the day.
62
+
63
+ ---
64
+
65
+ `{{ "{{TODO: add project-specific entries as they come up. The list below is intentionally short — generic entries that apply to every wp-kit project.}}" }}`
@@ -7,9 +7,9 @@ import { log, color } from '../../lib/utils/logger.js';
7
7
  /**
8
8
  * Derive a StudlyCase PSR-4 namespace fragment from a kebab/snake plugin slug.
9
9
  *
10
- * futrading-core -> FutradingCore
11
- * ecoautomacao-core -> EcoautomacaoCore
12
- * my_plugin -> MyPlugin
10
+ * acme-core -> AcmeCore
11
+ * my-site-core -> MySiteCore
12
+ * my_plugin -> MyPlugin
13
13
  */
14
14
  function toStudlyCase(slug) {
15
15
  return slug
@@ -22,8 +22,8 @@ function toStudlyCase(slug) {
22
22
  /**
23
23
  * Derive an UPPER_SNAKE constant prefix from a kebab/snake plugin slug.
24
24
  *
25
- * futrading-core -> FUTRADING_CORE
26
- * ecoautomacao-core -> ECOAUTOMACAO_CORE
25
+ * acme-core -> ACME_CORE
26
+ * my-site-core -> MY_SITE_CORE
27
27
  */
28
28
  function toConstantPrefix(slug) {
29
29
  return slug
@@ -9,7 +9,7 @@ export default [
9
9
  {
10
10
  type: 'confirm',
11
11
  name: 'mu_plugin_acorn',
12
- message: 'MU Plugin: bootstrap with Roots Acorn (recommended for the Hekivo stack)?',
12
+ message: 'MU Plugin: bootstrap with Roots Acorn (recommended for the Roots stack)?',
13
13
  default: true,
14
14
  when: (answers) => answers.selectedContentModules?.includes('mu-plugin'),
15
15
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codigodoleo/wp-kit",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "description": "Kit opinativo para padronizar projetos WordPress com CI/CD dinâmico.",
5
5
  "main": "bin/index.js",
6
6
  "bin": {