wordpress-agent-kit 0.4.0 → 0.6.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 (153) hide show
  1. package/.agents/skills/wp-bootstrap/SKILL.md +314 -0
  2. package/.agents/skills/wp-bootstrap/references/composer-setup.md +275 -0
  3. package/.agents/skills/wp-bootstrap/references/monorepo-patterns.md +184 -0
  4. package/.agents/skills/wp-bootstrap/scripts/bootstrap.sh +151 -0
  5. package/.agents/skills/wp-bootstrap/scripts/detect-structure.mjs +466 -0
  6. package/.agents/skills/wp-bootstrap/scripts/package-wp.sh +173 -0
  7. package/.agents/skills/wp-bootstrap/scripts/playground-start.sh +148 -0
  8. package/.agents/skills/wp-bootstrap/scripts/playground-verify.sh +165 -0
  9. package/.agents/skills/wp-bootstrap/scripts/setup-github.sh +417 -0
  10. package/{.github → .agents}/skills/wp-wpcli-and-ops/SKILL.md +11 -9
  11. package/.agents/skills/wp-wpengine/SKILL.md +462 -0
  12. package/.agents/skills/wp-wpengine/references/ci-gate.md +469 -0
  13. package/.agents/skills/wp-wpengine/references/github-actions-deploy.md +743 -0
  14. package/.agents/skills/wp-wpengine/scripts/ci-gate.sh +118 -0
  15. package/.agents/skills/wp-wpengine/scripts/wpe-check.sh +89 -0
  16. package/.agents/skills/wp-wpengine/scripts/wpe-preflight.sh +104 -0
  17. package/.github/agents/wp-architect.agent.md +1 -2
  18. package/.github/copilot-instructions.md +1 -1
  19. package/.github/instructions/wordpress-workflow.instructions.md +3 -3
  20. package/AGENTS.md +22 -10
  21. package/AGENTS.template.md +20 -10
  22. package/README.md +89 -85
  23. package/dist/cli.js +7 -1
  24. package/dist/commands/bootstrap.js +105 -0
  25. package/dist/commands/clean-skills.js +64 -0
  26. package/dist/commands/setup.js +6 -2
  27. package/dist/commands/sync-skills.js +3 -0
  28. package/dist/lib/api.js +165 -5
  29. package/dist/lib/bootstrap.js +352 -0
  30. package/dist/lib/installer.js +166 -2
  31. package/extensions/wp-agent-kit/index.ts +325 -10
  32. package/package.json +10 -14
  33. package/skills-custom/wp-bootstrap/SKILL.md +314 -0
  34. package/skills-custom/wp-bootstrap/references/composer-setup.md +275 -0
  35. package/skills-custom/wp-bootstrap/references/monorepo-patterns.md +184 -0
  36. package/skills-custom/wp-bootstrap/scripts/bootstrap.sh +151 -0
  37. package/skills-custom/wp-bootstrap/scripts/detect-structure.mjs +466 -0
  38. package/skills-custom/wp-bootstrap/scripts/package-wp.sh +173 -0
  39. package/skills-custom/wp-bootstrap/scripts/playground-start.sh +148 -0
  40. package/skills-custom/wp-bootstrap/scripts/playground-verify.sh +165 -0
  41. package/skills-custom/wp-bootstrap/scripts/setup-github.sh +417 -0
  42. package/skills-custom/wp-wpengine/SKILL.md +362 -27
  43. package/skills-custom/wp-wpengine/references/ci-gate.md +469 -0
  44. package/skills-custom/wp-wpengine/references/github-actions-deploy.md +743 -0
  45. package/skills-custom/wp-wpengine/scripts/ci-gate.sh +118 -0
  46. package/skills-custom/wp-wpengine/scripts/wpe-check.sh +89 -0
  47. package/skills-custom/wp-wpengine/scripts/wpe-preflight.sh +104 -0
  48. package/.github/skills/wp-wpengine/SKILL.md +0 -127
  49. package/.github/workflows/ci.yml +0 -44
  50. package/.husky/pre-commit +0 -7
  51. package/CLI_REVIEW.md +0 -250
  52. package/biome.json +0 -39
  53. /package/{.github → .agents}/skills/blueprint/SKILL.md +0 -0
  54. /package/{.github → .agents}/skills/wordpress-router/SKILL.md +0 -0
  55. /package/{.github → .agents}/skills/wordpress-router/references/decision-tree.md +0 -0
  56. /package/{.github → .agents}/skills/wp-abilities-api/SKILL.md +0 -0
  57. /package/{.github → .agents}/skills/wp-abilities-api/references/delegate-helper-pattern.md +0 -0
  58. /package/{.github → .agents}/skills/wp-abilities-api/references/domain-vs-projection.md +0 -0
  59. /package/{.github → .agents}/skills/wp-abilities-api/references/error-code-vocabulary.md +0 -0
  60. /package/{.github → .agents}/skills/wp-abilities-api/references/grouping-heuristic.md +0 -0
  61. /package/{.github → .agents}/skills/wp-abilities-api/references/input-schema-gotchas.md +0 -0
  62. /package/{.github → .agents}/skills/wp-abilities-api/references/php-registration.md +0 -0
  63. /package/{.github → .agents}/skills/wp-abilities-api/references/plugin-family-patterns.md +0 -0
  64. /package/{.github → .agents}/skills/wp-abilities-api/references/rest-api.md +0 -0
  65. /package/{.github → .agents}/skills/wp-abilities-api/references/shared-core-service.md +0 -0
  66. /package/{.github → .agents}/skills/wp-abilities-audit/SKILL.md +0 -0
  67. /package/{.github → .agents}/skills/wp-abilities-audit/references/audit-schema.md +0 -0
  68. /package/{.github → .agents}/skills/wp-abilities-audit/references/capability-gate-tracing.md +0 -0
  69. /package/{.github → .agents}/skills/wp-abilities-audit/references/controller-enumeration.md +0 -0
  70. /package/{.github → .agents}/skills/wp-abilities-verify/SKILL.md +0 -0
  71. /package/{.github → .agents}/skills/wp-abilities-verify/references/annotation-correctness.md +0 -0
  72. /package/{.github → .agents}/skills/wp-abilities-verify/references/audit-schema-validation.md +0 -0
  73. /package/{.github → .agents}/skills/wp-abilities-verify/references/permission-roundtrip.md +0 -0
  74. /package/{.github → .agents}/skills/wp-abilities-verify/references/runtime-harness.md +0 -0
  75. /package/{.github → .agents}/skills/wp-abilities-verify/references/schema-lints.md +0 -0
  76. /package/{.github → .agents}/skills/wp-abilities-verify/references/static-enumeration.md +0 -0
  77. /package/{.github → .agents}/skills/wp-block-development/SKILL.md +0 -0
  78. /package/{.github → .agents}/skills/wp-block-development/references/attributes-and-serialization.md +0 -0
  79. /package/{.github → .agents}/skills/wp-block-development/references/block-json.md +0 -0
  80. /package/{.github → .agents}/skills/wp-block-development/references/creating-new-blocks.md +0 -0
  81. /package/{.github → .agents}/skills/wp-block-development/references/debugging.md +0 -0
  82. /package/{.github → .agents}/skills/wp-block-development/references/deprecations.md +0 -0
  83. /package/{.github → .agents}/skills/wp-block-development/references/dynamic-rendering.md +0 -0
  84. /package/{.github → .agents}/skills/wp-block-development/references/inner-blocks.md +0 -0
  85. /package/{.github → .agents}/skills/wp-block-development/references/registration.md +0 -0
  86. /package/{.github → .agents}/skills/wp-block-development/references/supports-and-wrappers.md +0 -0
  87. /package/{.github → .agents}/skills/wp-block-development/references/tooling-and-testing.md +0 -0
  88. /package/{.github → .agents}/skills/wp-block-development/scripts/list_blocks.mjs +0 -0
  89. /package/{.github → .agents}/skills/wp-block-themes/SKILL.md +0 -0
  90. /package/{.github → .agents}/skills/wp-block-themes/references/creating-new-block-theme.md +0 -0
  91. /package/{.github → .agents}/skills/wp-block-themes/references/debugging.md +0 -0
  92. /package/{.github → .agents}/skills/wp-block-themes/references/patterns.md +0 -0
  93. /package/{.github → .agents}/skills/wp-block-themes/references/style-variations.md +0 -0
  94. /package/{.github → .agents}/skills/wp-block-themes/references/templates-and-parts.md +0 -0
  95. /package/{.github → .agents}/skills/wp-block-themes/references/theme-json.md +0 -0
  96. /package/{.github → .agents}/skills/wp-block-themes/scripts/detect_block_themes.mjs +0 -0
  97. /package/{.github → .agents}/skills/wp-interactivity-api/SKILL.md +0 -0
  98. /package/{.github → .agents}/skills/wp-interactivity-api/references/debugging.md +0 -0
  99. /package/{.github → .agents}/skills/wp-interactivity-api/references/directives-quickref.md +0 -0
  100. /package/{.github → .agents}/skills/wp-interactivity-api/references/server-side-rendering.md +0 -0
  101. /package/{.github → .agents}/skills/wp-performance/SKILL.md +0 -0
  102. /package/{.github → .agents}/skills/wp-performance/references/autoload-options.md +0 -0
  103. /package/{.github → .agents}/skills/wp-performance/references/cron.md +0 -0
  104. /package/{.github → .agents}/skills/wp-performance/references/database.md +0 -0
  105. /package/{.github → .agents}/skills/wp-performance/references/http-api.md +0 -0
  106. /package/{.github → .agents}/skills/wp-performance/references/measurement.md +0 -0
  107. /package/{.github → .agents}/skills/wp-performance/references/object-cache.md +0 -0
  108. /package/{.github → .agents}/skills/wp-performance/references/query-monitor-headless.md +0 -0
  109. /package/{.github → .agents}/skills/wp-performance/references/server-timing.md +0 -0
  110. /package/{.github → .agents}/skills/wp-performance/references/wp-cli-doctor.md +0 -0
  111. /package/{.github → .agents}/skills/wp-performance/references/wp-cli-profile.md +0 -0
  112. /package/{.github → .agents}/skills/wp-performance/scripts/perf_inspect.mjs +0 -0
  113. /package/{.github → .agents}/skills/wp-phpstan/SKILL.md +0 -0
  114. /package/{.github → .agents}/skills/wp-phpstan/references/configuration.md +0 -0
  115. /package/{.github → .agents}/skills/wp-phpstan/references/third-party-classes.md +0 -0
  116. /package/{.github → .agents}/skills/wp-phpstan/references/wordpress-annotations.md +0 -0
  117. /package/{.github → .agents}/skills/wp-phpstan/scripts/phpstan_inspect.mjs +0 -0
  118. /package/{.github → .agents}/skills/wp-playground/SKILL.md +0 -0
  119. /package/{.github → .agents}/skills/wp-playground/references/blueprints.md +0 -0
  120. /package/{.github → .agents}/skills/wp-playground/references/cli-commands.md +0 -0
  121. /package/{.github → .agents}/skills/wp-playground/references/debugging.md +0 -0
  122. /package/{.github → .agents}/skills/wp-playground/references/e2e-playwright.md +0 -0
  123. /package/{.github → .agents}/skills/wp-plugin-development/SKILL.md +0 -0
  124. /package/{.github → .agents}/skills/wp-plugin-development/references/data-and-cron.md +0 -0
  125. /package/{.github → .agents}/skills/wp-plugin-development/references/debugging.md +0 -0
  126. /package/{.github → .agents}/skills/wp-plugin-development/references/lifecycle.md +0 -0
  127. /package/{.github → .agents}/skills/wp-plugin-development/references/security.md +0 -0
  128. /package/{.github → .agents}/skills/wp-plugin-development/references/settings-api.md +0 -0
  129. /package/{.github → .agents}/skills/wp-plugin-development/references/structure.md +0 -0
  130. /package/{.github → .agents}/skills/wp-plugin-development/scripts/detect_plugins.mjs +0 -0
  131. /package/{.github → .agents}/skills/wp-plugin-directory-guidelines/SKILL.md +0 -0
  132. /package/{.github → .agents}/skills/wp-plugin-directory-guidelines/references/gpl-compliance.md +0 -0
  133. /package/{.github → .agents}/skills/wp-plugin-directory-guidelines/references/guideline-review-checklist.md +0 -0
  134. /package/{.github → .agents}/skills/wp-plugin-directory-guidelines/references/naming-rules.md +0 -0
  135. /package/{.github → .agents}/skills/wp-project-triage/SKILL.md +0 -0
  136. /package/{.github → .agents}/skills/wp-project-triage/references/triage.schema.json +0 -0
  137. /package/{.github → .agents}/skills/wp-project-triage/scripts/detect_wp_project.mjs +0 -0
  138. /package/{.github → .agents}/skills/wp-rest-api/SKILL.md +0 -0
  139. /package/{.github → .agents}/skills/wp-rest-api/references/authentication.md +0 -0
  140. /package/{.github → .agents}/skills/wp-rest-api/references/custom-content-types.md +0 -0
  141. /package/{.github → .agents}/skills/wp-rest-api/references/discovery-and-params.md +0 -0
  142. /package/{.github → .agents}/skills/wp-rest-api/references/responses-and-fields.md +0 -0
  143. /package/{.github → .agents}/skills/wp-rest-api/references/routes-and-endpoints.md +0 -0
  144. /package/{.github → .agents}/skills/wp-rest-api/references/schema.md +0 -0
  145. /package/{.github → .agents}/skills/wp-wpcli-and-ops/references/automation.md +0 -0
  146. /package/{.github → .agents}/skills/wp-wpcli-and-ops/references/cron-and-cache.md +0 -0
  147. /package/{.github → .agents}/skills/wp-wpcli-and-ops/references/debugging.md +0 -0
  148. /package/{.github → .agents}/skills/wp-wpcli-and-ops/references/multisite.md +0 -0
  149. /package/{.github → .agents}/skills/wp-wpcli-and-ops/references/packages-and-updates.md +0 -0
  150. /package/{.github → .agents}/skills/wp-wpcli-and-ops/references/safety.md +0 -0
  151. /package/{.github → .agents}/skills/wp-wpcli-and-ops/references/search-replace.md +0 -0
  152. /package/{.github → .agents}/skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs +0 -0
  153. /package/{.github → .agents}/skills/wpds/SKILL.md +0 -0
@@ -0,0 +1,462 @@
1
+ ---
2
+ name: wp-wpengine
3
+ description: "Optional: Use for WP Engine hosting workflows — SSH-based git push, remote WP-CLI via SSH gateway, GitHub Actions CI/CD with safety-gated deploys to dev/staging/production, managing installs/domains/cache/backups via the wpe-labs Claude Code skills, and WP Engine API access. Requires SSH key setup and WPE_USERNAME/WPE_PASSWORD env vars for API operations."
4
+ license: GPL-2.0-or-later
5
+ optional: true
6
+ ---
7
+
8
+ # WP Engine
9
+
10
+ ## When to use
11
+
12
+ - Deploy WordPress code to a WP Engine environment via `git push` or GitHub Actions.
13
+ - Set up a branch-gated CI/CD pipeline: `develop` → dev, `staging` → staging, `main` → production.
14
+ - Run WP-CLI commands remotely on a WP Engine install (plugin updates, cache flush, DB ops, search-replace).
15
+ - Manage WP Engine installs, domains, cache, backups, or users through natural language.
16
+ - Generate monthly usage/bandwidth reports across WP Engine accounts.
17
+ - Manage LargeFS media offload configuration.
18
+
19
+ ## Prerequisites
20
+
21
+ - SSH key stored in 1Password (`Employee` vault, item `wpengine_ed25519`).
22
+ > **Key type note:** RSA 4096-bit is the historically proven key type for WP Engine git push.
23
+ > Ed25519 is more modern and works on current WP Engine infrastructure, but if you're
24
+ > setting up a new key, RSA 4096 is the safest choice: `ssh-keygen -t rsa -b 4096 -f ~/.ssh/wpengine_rsa`
25
+ - SSH key registered in the WP Engine portal — both under **Git Push** and **SSH Keys** (two separate registrations, same key).
26
+ - WP Engine API credentials in 1Password (`Employee` vault, item `WP Engine API`).
27
+ - `op` CLI authenticated (`op whoami` works).
28
+ - SSH gateway access requires a **Professional plan or higher**.
29
+ - The `wpe-labs` Claude Code skills installed (`~/.claude/skills/wpe-labs:*`) for natural language management.
30
+
31
+ ---
32
+
33
+ ## Procedure
34
+
35
+ ### 1) First-time SSH setup on a new machine
36
+
37
+ Pull the private key from 1Password and configure SSH:
38
+
39
+ ```bash
40
+ op read "op://Employee/wpengine_ed25519/private key" > ~/.ssh/wpengine_ed25519
41
+ chmod 600 ~/.ssh/wpengine_ed25519
42
+
43
+ # Trust WP Engine git push host (RSA — what WP Engine's git.wpengine.com serves)
44
+ ssh-keyscan -t rsa git.wpengine.com >> ~/.ssh/known_hosts
45
+ # Gateway: scan the specific install hostname (each install has its own subdomain)
46
+ # Do this once per environment you connect to:
47
+ ssh-keyscan -H <install>.ssh.wpengine.net >> ~/.ssh/known_hosts
48
+ # e.g.: ssh-keyscan -H mysite.ssh.wpengine.net >> ~/.ssh/known_hosts
49
+ ```
50
+
51
+ Add to `~/.ssh/config` (before any `Host *` block):
52
+
53
+ ```
54
+ # WP Engine git push
55
+ Host git.wpengine.com
56
+ User git
57
+ IdentityFile ~/.ssh/wpengine_ed25519
58
+ IdentitiesOnly yes
59
+
60
+ # WP Engine SSH gateway (WP-CLI + file transfer)
61
+ Host *.ssh.wpengine.net
62
+ IdentityFile ~/.ssh/wpengine_ed25519
63
+ IdentitiesOnly yes
64
+ ControlMaster auto
65
+ ControlPath ~/.ssh/wpe-%r@%h:%p
66
+ ControlPersist 10m
67
+ StrictHostKeyChecking accept-new
68
+ ```
69
+
70
+ > **`StrictHostKeyChecking accept-new`**: automatically accepts and stores the host key on first connection, then rejects any change to that key (MITM protection). Safer than `no`; avoids having to manually `ssh-keyscan` each install hostname.
71
+ >
72
+ > **ControlMaster / ControlPersist**: multiplexes SSH connections so subsequent commands over the same gateway reuse the existing connection. Cuts per-command latency from ~2 s to ~100 ms for repeated WP-CLI invocations.
73
+
74
+ Verify git push access:
75
+
76
+ ```bash
77
+ ssh git@git.wpengine.com info
78
+ # Expected: hello <username> / R W <install-name>
79
+ ```
80
+
81
+ Verify SSH gateway access (replace `<install>` with the WP Engine install slug):
82
+
83
+ ```bash
84
+ ssh <install>@<install>.ssh.wpengine.net wp --info
85
+ # Expected: WP-CLI version + paths
86
+ ```
87
+
88
+ ---
89
+
90
+ ### 2) Deploy via git push
91
+
92
+ **Always get the exact remote URL from the WP Engine portal** — it includes the environment prefix:
93
+ `https://my.wpengine.com/installs/<ENV>/git_push`
94
+
95
+ The URL format is: `git@git.wpengine.com:<environment>/<install-name>.git`
96
+ where `<environment>` is `production`, `staging`, or `development`.
97
+
98
+ ```bash
99
+ # Production (copy exact URL from portal)
100
+ # ⚠️ Always copy the exact URL from the WP Engine portal — formats vary by account:
101
+ # https://my.wpengine.com/installs/<ENV>/git_push
102
+ #
103
+ # Modern accounts (most common):
104
+ git remote add wpengine-prod git@git.wpengine.com:<install-name>.git
105
+ # Legacy accounts (some plans add an environment prefix):
106
+ # git remote add wpengine-prod git@git.wpengine.com:production/<install-name>.git
107
+
108
+ # Staging (check portal for exact URL)
109
+ git remote add wpengine-staging git@git.wpengine.com:<install-name>stg.git
110
+
111
+ # Development (check portal for exact URL)
112
+ git remote add wpengine-dev git@git.wpengine.com:<install-name>dev.git
113
+ ```
114
+
115
+ Deploy:
116
+ ```bash
117
+ git push wpengine-prod main
118
+ # WP Engine expects the branch name 'main' on its remote
119
+ git push wpengine-staging staging:main
120
+ ```
121
+
122
+ - WP Engine deploys the pushed branch automatically.
123
+ - Only WordPress files are pushed — not `node_modules`, build artifacts, or `.git/`.
124
+ - After push, allow 1–2 min for propagation.
125
+
126
+ > **Verify the remote URL**: `git remote -v` should show `git@git.wpengine.com:production/<install>.git`.
127
+ > If it shows `git@git.wpengine.com:<install>.git` (no environment prefix), update it — that is an older format that may no longer work.
128
+
129
+ ---
130
+
131
+ ### 3) WP-CLI via SSH gateway
132
+
133
+ WP Engine's SSH gateway host is `{install}.ssh.wpengine.net` with username `{install}`.
134
+ The WordPress root on the server is `/home/wpe-user/sites/{install}`.
135
+
136
+ #### Method A — Direct SSH command (simplest)
137
+
138
+ ```bash
139
+ ssh <install>@<install>.ssh.wpengine.net wp <command>
140
+ ```
141
+
142
+ WP-CLI on WP Engine already knows the WordPress path, so `--path` is usually not required. If needed:
143
+
144
+ ```bash
145
+ ssh <install>@<install>.ssh.wpengine.net wp plugin list --path=/home/wpe-user/sites/<install>
146
+ ```
147
+
148
+ Always use `--skip-plugins --skip-themes` on production for safety:
149
+
150
+ ```bash
151
+ ssh <install>@<install>.ssh.wpengine.net \
152
+ wp cache flush --skip-plugins --skip-themes
153
+ ```
154
+
155
+ #### Method B — WP-CLI `--ssh` flag
156
+
157
+ WP-CLI's native `--ssh` flag runs any command against a remote install without logging in first:
158
+
159
+ ```bash
160
+ # Format: --ssh=user@host/path
161
+ wp --ssh=<install>@<install>.ssh.wpengine.net:/home/wpe-user/sites/<install> plugin list
162
+
163
+ # Shorthand — omit path if WP-CLI finds WP at the SSH user's home:
164
+ wp --ssh=<install>@<install>.ssh.wpengine.net cache flush
165
+ ```
166
+
167
+ #### Method C — `wp-cli.yml` aliases (best for repeated use)
168
+
169
+ Create or update `wp-cli.yml` in your local repo root:
170
+
171
+ ```yaml
172
+ # wp-cli.yml
173
+ @production:
174
+ ssh: <install>@<install>.ssh.wpengine.net
175
+ path: /home/wpe-user/sites/<install>
176
+
177
+ @staging:
178
+ ssh: <install>stg@<install>stg.ssh.wpengine.net
179
+ path: /home/wpe-user/sites/<install>stg
180
+ ```
181
+
182
+ Then use the alias for any command:
183
+
184
+ ```bash
185
+ wp @production plugin list --format=json
186
+ wp @staging cache flush
187
+ wp @production db export - > backup-$(date +%F).sql
188
+ wp @production search-replace 'old-domain.com' 'new-domain.com' --dry-run
189
+ ```
190
+
191
+ > Commit `wp-cli.yml` to the repo so all team members and CI pipelines share the same remote aliases.
192
+
193
+ #### Method D — SCP / rsync for file transfer
194
+
195
+ The SSH gateway also accepts SCP and rsync (port 22). Use this to pull/push files without a full git push:
196
+
197
+ ```bash
198
+ # SCP: download a file from the server
199
+ scp -P 22 <install>@<install>.ssh.wpengine.net:sites/<install>/wp-content/uploads/large-file.zip ./
200
+
201
+ # SCP: upload a file to the server
202
+ scp -P 22 ./my-patch.php <install>@<install>.ssh.wpengine.net:sites/<install>/wp-content/plugins/my-plugin/
203
+
204
+ # rsync: sync wp-content/uploads from production to local (read-only pull)
205
+ rsync -avz --progress \
206
+ -e "ssh -p 22" \
207
+ <install>@<install>.ssh.wpengine.net:sites/<install>/wp-content/uploads/ \
208
+ ./local-uploads/
209
+
210
+ # rsync: push a theme to staging (careful with --delete)
211
+ rsync -avz --dry-run \
212
+ -e "ssh -p 22" \
213
+ ./my-theme/ \
214
+ <install>stg@<install>stg.ssh.wpengine.net:sites/<install>stg/wp-content/themes/my-theme/
215
+ ```
216
+
217
+ > **WP Engine server path**: WordPress root is `sites/<install>/` relative to the SSH home, or `/home/wpe-user/sites/<install>` as an absolute path. `wp-content/` lives inside that root.
218
+
219
+ #### Method E — Multiple commands via heredoc
220
+
221
+ Run several commands in one SSH session without reconnecting:
222
+
223
+ ```bash
224
+ # Heredoc over SSH (most efficient — one connection for all commands)
225
+ ssh <install>@<install>.ssh.wpengine.net bash -s << 'EOF'
226
+ set -e
227
+ wp cache flush --skip-plugins --skip-themes
228
+ wp rewrite flush --skip-plugins --skip-themes
229
+ wp cron event run --due-now --skip-plugins --skip-themes
230
+ wp core version --skip-plugins --skip-themes
231
+ EOF
232
+
233
+ # Interactive WP-CLI commands need -t (pseudo-TTY allocation)
234
+ # e.g. wp shell for a REPL session
235
+ ssh -t <install>@<install>.ssh.wpengine.net wp shell
236
+ ```
237
+
238
+ #### SSH gateway environment notes
239
+
240
+ - **Restricted shell**: The gateway provides a limited shell environment. WP-CLI, PHP, basic POSIX utilities (echo, cat, stat, du, find, grep) and rsync/SCP are available. Package installation (`apt`, `yum`), sudo, and arbitrary service management are **not** available.
241
+ - **PHP version**: Matches the PHP version configured for that WP Engine install. `php --version` to confirm.
242
+ - **WordPress path**: `~/sites/<install>/` (relative to SSH home) or `/home/wpe-user/sites/<install>` (absolute).
243
+ - **`--path` flag**: If WP-CLI returns "not a WordPress installation", add `--path=/home/wpe-user/sites/<install>` explicitly.
244
+ - **Legacy gateway**: `ssh.wpengine.net` (no subdomain) is the old generic gateway address. Current convention always uses `<install>.ssh.wpengine.net`.
245
+
246
+ ---
247
+
248
+ ### 4) Common remote WP-CLI operations
249
+
250
+ Always run `--dry-run` or a read-only check first. All examples use Method C aliases.
251
+
252
+ #### Inspect the environment
253
+
254
+ ```bash
255
+ wp @production cli info
256
+ wp @production option get siteurl
257
+ wp @production option get home
258
+ wp @production core version
259
+ ```
260
+
261
+ #### Plugin and theme management
262
+
263
+ ```bash
264
+ # List all plugins with status
265
+ wp @production plugin list --format=json
266
+
267
+ # Update a specific plugin
268
+ wp @production plugin update woocommerce
269
+
270
+ # Update all plugins (preview first)
271
+ wp @production plugin update --all --dry-run
272
+ wp @production plugin update --all
273
+
274
+ # Activate/deactivate
275
+ wp @production plugin activate <slug>
276
+ wp @production plugin deactivate <slug> --skip-plugins --skip-themes
277
+ ```
278
+
279
+ #### Cache flush (always safe post-deploy)
280
+
281
+ ```bash
282
+ wp @production cache flush
283
+ wp @production rewrite flush
284
+ wp @production transient delete --all
285
+ ```
286
+
287
+ #### Database operations
288
+
289
+ ```bash
290
+ # Export to local file (streams via SSH)
291
+ wp @production db export - > backup-$(date +%F-%H%M).sql
292
+
293
+ # Check DB size
294
+ wp @production db size --tables --format=table
295
+
296
+ # Run a specific query
297
+ wp @production db query "SELECT option_name, option_value FROM wp_options WHERE autoload='yes' LIMIT 20"
298
+ ```
299
+
300
+ #### Search and replace (migration / domain change)
301
+
302
+ ```bash
303
+ # Always dry-run first
304
+ wp @production search-replace 'http://old-domain.com' 'https://new-domain.com' \
305
+ --dry-run --report-changed-only
306
+
307
+ # Then apply (--precise handles serialized data safely)
308
+ wp @production search-replace 'http://old-domain.com' 'https://new-domain.com' \
309
+ --precise --report-changed-only
310
+
311
+ # Flush after replace
312
+ wp @production cache flush && wp @production rewrite flush
313
+ ```
314
+
315
+ See `wp-wpcli-and-ops` skill → `references/search-replace.md` for full search-replace patterns.
316
+
317
+ #### User management
318
+
319
+ ```bash
320
+ # List admin users
321
+ wp @production user list --role=administrator --format=table
322
+
323
+ # Create a temporary admin (disable after)
324
+ wp @production user create tempagent temp@example.com --role=administrator --user_pass=<strong-pass>
325
+ # ... do work ...
326
+ wp @production user delete tempagent --reassign=1
327
+ ```
328
+
329
+ #### Cron inspection and triggering
330
+
331
+ ```bash
332
+ wp @production cron event list --format=table
333
+ wp @production cron event run --due-now
334
+ wp @production cron event run <hook-name>
335
+ ```
336
+
337
+ ---
338
+
339
+ ### 7) GitHub Actions CI/CD pipeline
340
+
341
+ For full branch-gated deploys with safety guards, pre-deploy backups, smoke tests, and auto-rollback:
342
+
343
+ Read: `references/github-actions-deploy.md`
344
+
345
+ **CI gate policy — no `--no-verify`:**
346
+ - All lint, typecheck, tests, and build checks must pass before any push reaches a deploy branch.
347
+ - `--no-verify` is explicitly forbidden. Hooks exist to surface problems early — bypass them and you own the breakage.
348
+ - The CI gate runs two parallel jobs (`php-gate` + `js-gate`) for every push to a protected branch. Required status check.
349
+ - Every deploy workflow runs a `verify` job as its first dependency — deploys never start without it passing.
350
+
351
+ Read: `references/ci-gate.md`
352
+
353
+ **Agent-runnable scripts:**
354
+
355
+ | Script | Purpose | When to use |
356
+ |--------|---------|-------------|
357
+ | `scripts/ci-gate.sh` | Run the full local CI gate (PHP + JS/TS) | Before any push to a deploy branch |
358
+ | `scripts/wpe-preflight.sh` | Pre-deploy sanity checks (SSH, WP, HTTP) | Before triggering a deploy |
359
+ | `scripts/wpe-check.sh` | SSH connectivity to all configured installs | After machine setup or debugging SSH |
360
+
361
+ Run CI gate locally:
362
+ ```bash
363
+ bash {baseDir}/scripts/ci-gate.sh
364
+ ```
365
+
366
+ Run pre-deploy preflight:
367
+ ```bash
368
+ INSTALL=mysite bash {baseDir}/scripts/wpe-preflight.sh production
369
+ ```
370
+
371
+ Check all SSH connections:
372
+ ```bash
373
+ bash {baseDir}/scripts/wpe-check.sh
374
+ ```
375
+
376
+ ---
377
+
378
+ ### 8) wpe-labs skills (natural language management)
379
+
380
+ Load API credentials, then use any `/wpe-labs:*` skill:
381
+
382
+ ```bash
383
+ # Load credentials from 1Password for the session
384
+ eval $(op run --env-file ~/.config/op-ssh/.env.1pass -- env | grep ^WPE | sed 's/^/export /')
385
+ ```
386
+
387
+ | Skill | What it does | Risk |
388
+ |---|---|---|
389
+ | `/wpe-labs:account-usage` | Bandwidth, visits, storage across accounts | 🟢 Read-only |
390
+ | `/wpe-labs:monthly-report` | Client-ready monthly usage report | 🟢 Read-only |
391
+ | `/wpe-labs:backups` | On-demand backups + progress monitoring | 🟡 Write |
392
+ | `/wpe-labs:cache` | Purge object/page/CDN cache | 🟡 Write |
393
+ | `/wpe-labs:users` | List, invite, update roles, remove users | 🟡/🔴 |
394
+ | `/wpe-labs:domains` | Manage domains, DNS, SSL | 🟡/🔴 |
395
+ | `/wpe-labs:installs` | List, create, copy WordPress installs | 🟡/🔴 |
396
+ | `/wpe-labs:offload` | LargeFS media offload config | 🟡 Write |
397
+
398
+ Example prompts:
399
+
400
+ ```
401
+ /wpe-labs:account-usage which accounts are closest to their bandwidth limit?
402
+ /wpe-labs:cache purge all cache for uofdev production
403
+ /wpe-labs:backups back up uofdev production before deployment
404
+ /wpe-labs:installs copy uofdev production to staging
405
+ /wpe-labs:monthly-report last month
406
+ ```
407
+
408
+ ### 9) Re-installing wpe-labs skills
409
+
410
+ ```bash
411
+ curl -fsSL https://raw.githubusercontent.com/wpengine/wpe-labs-platform-skills/main/install.sh | bash
412
+ ```
413
+
414
+ ---
415
+
416
+ ## Verification
417
+
418
+ | Check | Command |
419
+ |---|---|
420
+ | Git push SSH | `ssh git@git.wpengine.com info` → `hello <user> / R W <install>` |
421
+ | SSH gateway | `ssh <install>@<install>.ssh.wpengine.net wp --info` |
422
+ | WP-CLI alias | `wp @production core version` |
423
+ | API credentials | `op run --env-file ~/.config/op-ssh/.env.1pass -- bash -c 'curl -s -u "$WPE_USERNAME:$WPE_PASSWORD" https://api.wpengineapi.com/v1/user | jq .email'` |
424
+
425
+ ---
426
+
427
+ ## Safety guardrails for remote operations
428
+
429
+ - **Always `--dry-run` first** for any search-replace or destructive DB operation.
430
+ - **Always export a DB backup** before schema changes or large search-replaces.
431
+ - **Use `--skip-plugins --skip-themes`** on production for cache flush, deactivations, and anything where a broken plugin might short-circuit the operation.
432
+ - **Prefer staging** for testing WP-CLI commands before running on production.
433
+ - **ControlMaster is safe** — it reuses an existing authenticated session; no new credentials are stored.
434
+ - **wpe-labs write operations** (`backups`, `cache`, `installs`, `users`, `domains`) should be confirmed before execution.
435
+
436
+ ---
437
+
438
+ ## Failure modes
439
+
440
+ | Symptom | Fix |
441
+ |---|---|
442
+ | `Host key verification failed` (git) | `ssh-keyscan git.wpengine.com >> ~/.ssh/known_hosts` |
443
+ | `Host key verification failed` (gateway) | Run `ssh-keyscan -H <install>.ssh.wpengine.net >> ~/.ssh/known_hosts` for that specific install hostname. Or add `StrictHostKeyChecking accept-new` to the `*.ssh.wpengine.net` SSH config block — it will auto-accept on first connect. |
444
+ | `Permission denied` | Confirm key at `~/.ssh/wpengine_ed25519`, `chmod 600`. Check the key is registered under **SSH Keys** in the WP Engine portal (separate from git push keys). |
445
+ | `git push rejected` | Get the exact URL from the portal (`https://my.wpengine.com/installs/<ENV>/git_push`). URL format varies by account — copy it verbatim. |
446
+ | SSH gateway hangs | Kill stale ControlMaster socket: `ssh -O stop <install>@<install>.ssh.wpengine.net` |
447
+ | `wp: command not found` on gateway | WP Engine's WP-CLI path: try `php /usr/local/bin/wp` or contact WP Engine support |
448
+ | WP-CLI returns wrong site | Add `--path=/home/wpe-user/sites/<install>` explicitly |
449
+ | `401 Unauthorized` (wpe-labs) | Regenerate API credentials at `https://my.wpengine.com/api_access`, update 1Password item |
450
+ | `storage shows zero` (wpe-labs) | Ask to "refresh storage" (async recalculation, ~30–60 s) |
451
+
452
+ ---
453
+
454
+ ## References
455
+
456
+ - WP Engine SSH gateway docs: `https://wpengine.com/support/ssh-gateway/`
457
+ - WP Engine git push portal: `https://my.wpengine.com/installs/<ENV>/git_push`
458
+ - WP Engine SSH Keys portal: `https://my.wpengine.com/ssh_keys`
459
+ - WP Engine API access: `https://my.wpengine.com/api_access`
460
+ - WP-CLI `--ssh` docs: `https://make.wordpress.org/cli/handbook/guides/running-commands-remotely/`
461
+ - wpe-labs skills source: `https://github.com/wpengine/wpe-labs-platform-skills`
462
+ - SSH setup log (first machine): gist `602d6a16ddfea438c0611a8e5cc31d5e`