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,314 @@
1
+ ---
2
+ name: wp-bootstrap
3
+ description: "Bootstrap a new or existing WordPress project with the full wp-agent-kit system: monorepo detection, Composer/WPackagist/SatisPress setup, Playground local dev, WP Engine dev/staging/production, CI gate, git hooks, and plugin packaging. Use when setting up a new WordPress project from scratch, onboarding an existing codebase, or wiring up a monorepo with multiple plugins/themes."
4
+ license: GPL-2.0-or-later
5
+ optional: true
6
+ ---
7
+
8
+ # WordPress Project Bootstrapper
9
+
10
+ One command to wire a WordPress project (single plugin, block theme, or monorepo with
11
+ multiple packages) into the full wp-agent-kit system: local Playground dev, WP Engine
12
+ deploy environments, Composer-managed PHP deps, CI gate, and git hooks.
13
+
14
+ ## When to use
15
+
16
+ - Setting up a new WordPress plugin, theme, or block theme from scratch.
17
+ - Onboarding an existing codebase to use the full agent toolkit.
18
+ - Wiring up a monorepo (multiple plugins/themes + JS packages in one repo) — like the
19
+ wp-agent-os pattern: `wpaos/` + `wpaos-blocks/` + `wpaos-theme/` + JS packages.
20
+ - Adding Composer (WPackagist + optional SatisPress) to a WordPress project.
21
+ - Configuring WP Engine dev/staging/production + GitHub Actions CI/CD.
22
+
23
+ ## What gets set up
24
+
25
+ | Component | What | Where |
26
+ |-----------|------|-------|
27
+ | Agent kit | Skills, agents, instructions | `.agents/skills/` + `.github/` |
28
+ | PHP tooling | PHPCS + PHPStan + Pest | `composer.json` + `phpcs.xml.dist` + `phpstan.neon.dist` |
29
+ | JS tooling | Biome (lint+format) | `biome.json` |
30
+ | Git hooks | Pre-push gate | `.githooks/pre-push` |
31
+ | One-command setup | `tools/setup.sh` | `tools/setup.sh` |
32
+ | WP-CLI aliases | Local path + WPE SSH | `wp-cli.yml` |
33
+ | Playground | Multi-mount interactive + headless verify | `tools/playground/` |
34
+ | WP Engine CI/CD | Branch-gated deploy workflows | `.github/workflows/` |
35
+ | Plugin packaging | Build + zip for upload | `tools/package-wp.sh` |
36
+ | Composer | WPackagist + optional SatisPress | `composer.json` + `auth.json` |
37
+ | Config | Monorepo layout declaration | `wp-bootstrap.config.json` |
38
+
39
+ ---
40
+
41
+ ## Procedure
42
+
43
+ ### 1) Probe the repository (always first)
44
+
45
+ Run the structure detector. It identifies WP packages, JS workspaces, existing tooling,
46
+ WP Engine remotes, **GitHub CLI status, existing secrets, and branch protection**.
47
+
48
+ ```bash
49
+ node {baseDir}/scripts/detect-structure.mjs --pretty
50
+ ```
51
+
52
+ Key fields in the output:
53
+
54
+ | Field | What it tells you |
55
+ |-------|------------------|
56
+ | `isMonorepo` | Multiple WP packages or JS workspaces |
57
+ | `wpPackages[]` | Plugin/theme dirs, slugs, versions |
58
+ | `wpRoot` | Where WP core lives (null = Playground-only) |
59
+ | `wpeRemotes[]` | Existing WP Engine git remotes |
60
+ | `php.hasPhpcs` | PHPCS already configured |
61
+ | `js.hasBiome` | Biome already configured |
62
+ | `playground.hasPlayground` | Playground scripts/blueprints already exist |
63
+ | `hasAgentKit` | wp-agent-kit already installed |
64
+ | `github.ghInstalled` | `gh` CLI available |
65
+ | `github.authenticated` | `gh auth status` passes |
66
+ | `github.existingSecrets[]` | GitHub Actions secrets already set |
67
+ | `github.missingSecrets[]` | Required WPE secrets not yet set |
68
+ | `github.branchProtection` | Protection status per branch |
69
+
70
+ For JSON output (useful in scripts/CI):
71
+ ```bash
72
+ node {baseDir}/scripts/detect-structure.mjs
73
+ ```
74
+
75
+ Read: `references/monorepo-patterns.md` to match the detected structure to a known pattern.
76
+
77
+ ---
78
+
79
+ ### 2) Ask what the probe couldn't determine
80
+
81
+ If any of these are unknown after the probe, ask the user before proceeding:
82
+
83
+ | Question | When to ask |
84
+ |----------|------------|
85
+ | WP Engine install slugs (prod/staging/dev)? | `wpeRemotes` is empty |
86
+ | WP root path (or Playground-only)? | `wpRoot` is null AND WP packages found |
87
+ | Build command for generated packages? | Has generated `*-blocks` or `*-theme` packages |
88
+ | SatisPress URL + API key? | User has premium plugins to manage |
89
+ | Package manager preference? | `packageManager` is null |
90
+ | Deploy strategy for monorepo? | Multiple WP packages + no WPE remotes |
91
+ | Is `gh` CLI installed and authenticated? | Check `github.ghInstalled` and `github.authenticated` |
92
+
93
+ ---
94
+
95
+ ### 3) Install the agent kit
96
+
97
+ ```bash
98
+ wp-agent-kit install . --platform github
99
+ ```
100
+
101
+ Or for Pi:
102
+ ```bash
103
+ wp-agent-kit install . --platform pi
104
+ ```
105
+
106
+ This installs `.agents/skills/`, `.github/agents/`, `.github/instructions/`, and `AGENTS.md`.
107
+
108
+ ---
109
+
110
+ ### 4) Set up PHP tooling
111
+
112
+ If `php.hasComposer` is false or `php.hasPhpcs` is false:
113
+
114
+ ```bash
115
+ # Create root composer.json (dev tooling — not shipped)
116
+ # See references/composer-setup.md for the full template
117
+ composer init --no-interaction
118
+ composer require --dev squizlabs/php_codesniffer wp-coding-standards/wpcs \
119
+ phpcompatibility/phpcompatibility-wp dealerdirect/phpcodesniffer-composer-installer \
120
+ szepeviktor/phpstan-wordpress
121
+
122
+ # Register WordPress standards
123
+ composer run register-standards
124
+ ```
125
+
126
+ For plugin-level tests (Pest), in each plugin directory:
127
+ ```bash
128
+ cd <plugin-dir>
129
+ composer require --dev pestphp/pest
130
+ ```
131
+
132
+ Read: `references/composer-setup.md` for `phpcs.xml.dist` and `phpstan.neon.dist` templates.
133
+
134
+ ---
135
+
136
+ ### 5) Set up Composer repositories
137
+
138
+ **WPackagist** (free, for wordpress.org plugins/themes):
139
+ ```bash
140
+ composer config repositories.wpackagist composer https://wpackagist.org
141
+ composer require composer/installers
142
+ ```
143
+
144
+ **SatisPress** (optional, for premium plugins):
145
+ ```bash
146
+ composer config repositories.satispress composer https://<your-satispress-site>/satispress/
147
+ composer config http-basic.<your-satispress-site> <API_KEY> satispress
148
+ ```
149
+
150
+ Read: `references/composer-setup.md` for auth.json and full setup.
151
+
152
+ ---
153
+
154
+ ### 6) Set up JS tooling (Biome)
155
+
156
+ If `js.hasBiome` is false:
157
+ ```bash
158
+ npm install --save-dev @biomejs/biome
159
+ npx biome init
160
+ ```
161
+
162
+ Update `biome.json` to match project style. Reference: wp-agent-os uses:
163
+ - `indentStyle: "space"`, `indentWidth: 2` (for monorepos with JS packages)
164
+ - `indentStyle: "tab"` (for TS/JS-only projects like wp-agent-kit itself)
165
+ - Excludes: `wpaos-blocks/`, `wpaos-theme/` (generated), `dist/`, `vendor/`
166
+
167
+ ---
168
+
169
+ ### 7) Set up git hooks
170
+
171
+ Create `.githooks/pre-push` (no Husky dependency — works in all setups):
172
+
173
+ ```bash
174
+ mkdir -p .githooks
175
+ # See ci-gate.md in wp-wpengine skill for the full template
176
+ cat > .githooks/pre-push << 'HOOK'
177
+ #!/usr/bin/env bash
178
+ set -uo pipefail
179
+ root="$(git rev-parse --show-toplevel)"
180
+ cd "$root"
181
+ bash .agents/skills/wp-bootstrap/scripts/ci-gate.sh || exit 1
182
+ HOOK
183
+ chmod +x .githooks/pre-push
184
+
185
+ # Activate
186
+ git config core.hooksPath .githooks
187
+ ```
188
+
189
+ Or run the bootstrap script which handles all of this:
190
+ ```bash
191
+ bash {baseDir}/scripts/bootstrap.sh
192
+ ```
193
+
194
+ ---
195
+
196
+ ### 8) Create `wp-cli.yml`
197
+
198
+ ```yaml
199
+ # wp-cli.yml — WP-CLI targeting. Commit to repo.
200
+
201
+ # Local (if WP is in this repo)
202
+ # path: ./web # Bedrock style
203
+ # path: . # WP at root
204
+
205
+ @production:
206
+ ssh: <install>@<install>.ssh.wpengine.net
207
+ path: /home/wpe-user/sites/<install>
208
+
209
+ @staging:
210
+ ssh: <install>stg@<install>stg.ssh.wpengine.net
211
+ path: /home/wpe-user/sites/<install>stg
212
+
213
+ @development:
214
+ ssh: <install>dev@<install>dev.ssh.wpengine.net
215
+ path: /home/wpe-user/sites/<install>dev
216
+ ```
217
+
218
+ ---
219
+
220
+ ### 9) Set up WordPress Playground
221
+
222
+ Start interactive Playground with all local plugins/themes mounted:
223
+ ```bash
224
+ bash {baseDir}/scripts/playground-start.sh
225
+ ```
226
+
227
+ Run headless verification (no browser):
228
+ ```bash
229
+ bash {baseDir}/scripts/playground-verify.sh
230
+ ```
231
+
232
+ Package plugins for upload to live sites:
233
+ ```bash
234
+ bash {baseDir}/scripts/package-wp.sh
235
+ ```
236
+
237
+ Read: `references/monorepo-patterns.md` for multi-mount configurations.
238
+
239
+ ---
240
+
241
+ ### 10) Set up GitHub repo with `gh` CLI
242
+
243
+ If `github.ghInstalled` is true, use the GitHub setup script to:
244
+ - Verify authentication and repo access
245
+ - Check which required secrets are already set
246
+ - Set missing secrets interactively (SSH key, known hosts, WPE install slugs, API credentials)
247
+ - Configure branch protection for `main`, `staging`, and `develop`
248
+
249
+ ```bash
250
+ # Check-only first (no changes)
251
+ bash {baseDir}/scripts/setup-github.sh --check-only
252
+
253
+ # Set missing secrets interactively
254
+ bash {baseDir}/scripts/setup-github.sh --set-secrets
255
+
256
+ # Configure branch protection
257
+ bash {baseDir}/scripts/setup-github.sh --set-protection
258
+
259
+ # Do everything at once
260
+ bash {baseDir}/scripts/setup-github.sh --set-all
261
+
262
+ # Pass WPE slugs to skip those prompts
263
+ bash {baseDir}/scripts/setup-github.sh --set-all \
264
+ --wpe-prod=mysite --wpe-staging=mysitestg --wpe-dev=mysitedev
265
+ ```
266
+
267
+ The script handles `WPE_SSH_KNOWN_HOSTS` automatically via `ssh-keyscan`, and reads
268
+ `WPE_SSH_KEY` from `~/.ssh/wpengine_ed25519` if present (or from 1Password via `op read`).
269
+
270
+ > If `gh` is not installed: `brew install gh` (macOS) or see https://cli.github.com.
271
+ > After install: `gh auth login`.
272
+
273
+ ---
274
+
275
+ ### 11) Set up WP Engine GitHub Actions CI/CD
276
+
277
+ Read the `wp-wpengine` skill:
278
+ - `references/ci-gate.md` — CI gate with PHP + JS parallel jobs, no-verify policy
279
+ - `references/github-actions-deploy.md` — deploy workflows for dev/staging/production
280
+
281
+ Required GitHub Secrets:
282
+ ```
283
+ WPE_SSH_KEY — private key for WP Engine SSH
284
+ WPE_SSH_KNOWN_HOSTS — output of ssh-keyscan for git.wpengine.com
285
+ WPE_PROD_INSTALL — production install slug
286
+ WPE_PROD_GIT_URL — exact URL from WPE portal (git_push page)
287
+ WPE_STAGING_INSTALL / WPE_STAGING_GIT_URL
288
+ WPE_DEV_INSTALL / WPE_DEV_GIT_URL
289
+ WPE_API_USER / WPE_API_PASSWORD — for pre-deploy DB backups
290
+ ```
291
+
292
+ ---
293
+
294
+ ## Agent scripts
295
+
296
+ | Script | Purpose | Usage |
297
+ |--------|---------|-------|
298
+ | `scripts/detect-structure.mjs` | Probe repo structure + GitHub status → JSON | `node {baseDir}/scripts/detect-structure.mjs [--pretty]` |
299
+ | `scripts/bootstrap.sh` | One-command setup (hooks + PHP + JS deps) | `bash {baseDir}/scripts/bootstrap.sh` |
300
+ | `scripts/setup-github.sh` | Check/set GitHub secrets + branch protection via `gh` | `bash {baseDir}/scripts/setup-github.sh [--set-all]` |
301
+ | `scripts/package-wp.sh` | Build + zip WP plugins/themes | `bash {baseDir}/scripts/package-wp.sh [--dry-run]` |
302
+ | `scripts/playground-start.sh` | Start interactive Playground | `bash {baseDir}/scripts/playground-start.sh` |
303
+ | `scripts/playground-verify.sh` | Headless WP verification | `bash {baseDir}/scripts/playground-verify.sh` |
304
+
305
+ ---
306
+
307
+ ## References
308
+
309
+ - `references/monorepo-patterns.md` — WordPress monorepo structure patterns
310
+ - `references/composer-setup.md` — Composer, WPackagist, SatisPress setup
311
+ - `wp-wpengine` skill → `references/ci-gate.md` — PHP + JS CI gates, no-verify policy
312
+ - `wp-wpengine` skill → `references/github-actions-deploy.md` — deploy workflows
313
+ - `wp-playground` skill — Playground CLI, blueprints, PHPUnit, Playwright E2E
314
+ - `wp-phpstan` skill — PHPStan configuration for WordPress
@@ -0,0 +1,275 @@
1
+ # Composer Setup for WordPress Projects
2
+
3
+ ## Two-level Composer structure (from wp-agent-os)
4
+
5
+ The wp-agent-os pattern cleanly separates dev tooling from runtime deps:
6
+
7
+ ```
8
+ project/
9
+ ├── composer.json ← ROOT: dev tooling only. Never shipped.
10
+ │ Contains: phpcs, wpcs, phpstan, phpcompatibility
11
+ ├── vendor/ ← gitignored. Only dev tools.
12
+
13
+ └── wpaos/
14
+ ├── composer.json ← PLUGIN: test deps only (Pest). Never shipped.
15
+ └── vendor/ ← gitignored.
16
+ ```
17
+
18
+ **The rule:** plugins and themes should have **zero runtime Composer dependencies**.
19
+ All PHP dependencies are either:
20
+ - Part of WordPress core, or
21
+ - Managed at the WP install level via Bedrock/Composer-managed WP
22
+
23
+ ---
24
+
25
+ ## Root `composer.json` — PHP dev tooling template
26
+
27
+ ```json
28
+ {
29
+ "name": "myorg/my-project-dev",
30
+ "description": "Dev tooling — PHPCS/PHPStan. NOT shipped with plugins.",
31
+ "type": "project",
32
+ "license": "GPL-2.0-or-later",
33
+ "require": {
34
+ "php": ">=8.1"
35
+ },
36
+ "require-dev": {
37
+ "squizlabs/php_codesniffer": "^3.11",
38
+ "wp-coding-standards/wpcs": "^3.1",
39
+ "phpcompatibility/phpcompatibility-wp": "^2.1",
40
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
41
+ "szepeviktor/phpstan-wordpress": "^2.0"
42
+ },
43
+ "config": {
44
+ "allow-plugins": {
45
+ "dealerdirect/phpcodesniffer-composer-installer": true
46
+ },
47
+ "sort-packages": true
48
+ },
49
+ "scripts": {
50
+ "register-standards": "phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs,...",
51
+ "post-install-cmd": "@register-standards",
52
+ "post-update-cmd": "@register-standards",
53
+ "phpcs": "phpcs",
54
+ "phpcbf": "phpcbf",
55
+ "fix": "@phpcbf",
56
+ "phpstan":"phpstan analyse --memory-limit=1G",
57
+ "lint": ["@phpcs", "@phpstan"],
58
+ "gate": ["@phpcbf", "@phpcs", "@phpstan"]
59
+ }
60
+ }
61
+ ```
62
+
63
+ Key `scripts` mnemonics from wp-agent-os:
64
+ - `composer fix` = phpcbf (auto-fix) — run FIRST
65
+ - `composer lint` = phpcs + phpstan (check)
66
+ - `composer gate` = fix + lint (full pre-push gate)
67
+
68
+ ---
69
+
70
+ ## Per-plugin `composer.json` — Pest tests only
71
+
72
+ ```json
73
+ {
74
+ "name": "myorg/my-plugin",
75
+ "type": "wordpress-plugin",
76
+ "require-dev": {
77
+ "pestphp/pest": "^3.0"
78
+ },
79
+ "autoload-dev": {
80
+ "psr-4": { "MyPlugin\\Tests\\": "tests/" }
81
+ },
82
+ "scripts": {
83
+ "test": "pest --configuration=tests/phpunit.xml",
84
+ "test:unit": "pest --configuration=tests/phpunit.xml --group=unit",
85
+ "test:integration":"pest --configuration=tests/phpunit.xml --group=integration"
86
+ },
87
+ "config": {
88
+ "allow-plugins": { "pestphp/pest-plugin": true }
89
+ }
90
+ }
91
+ ```
92
+
93
+ ---
94
+
95
+ ## `phpcs.xml.dist` — WordPress coding standards
96
+
97
+ ```xml
98
+ <?xml version="1.0"?>
99
+ <ruleset name="my-plugin">
100
+ <description>WordPress coding standards + PHP 8.1 compat.</description>
101
+
102
+ <file>src</file> <!-- or your plugin root -->
103
+ <exclude-pattern>*/vendor/*</exclude-pattern>
104
+ <exclude-pattern>*/node_modules/*</exclude-pattern>
105
+ <exclude-pattern>*/tests/*</exclude-pattern>
106
+
107
+ <arg name="extensions" value="php"/>
108
+ <arg name="basepath" value="."/>
109
+ <arg name="parallel" value="8"/>
110
+ <arg name="colors"/>
111
+ <arg value="sp"/>
112
+
113
+ <rule ref="WordPress-Extra"/>
114
+
115
+ <config name="minimum_wp_version" value="6.7"/>
116
+ <config name="testVersion" value="8.1-"/>
117
+ <rule ref="PHPCompatibilityWP"/>
118
+
119
+ <rule ref="WordPress.WP.I18n">
120
+ <properties>
121
+ <property name="text_domain" type="array">
122
+ <element value="my-plugin"/>
123
+ </property>
124
+ </properties>
125
+ </rule>
126
+
127
+ <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
128
+ <properties>
129
+ <property name="prefixes" type="array">
130
+ <element value="myplugin"/>
131
+ <element value="MYPLUGIN"/>
132
+ </property>
133
+ </properties>
134
+ </rule>
135
+ </ruleset>
136
+ ```
137
+
138
+ ---
139
+
140
+ ## `phpstan.neon.dist` — Static analysis with WordPress stubs
141
+
142
+ ```neon
143
+ includes:
144
+ - vendor/szepeviktor/phpstan-wordpress/extension.neon
145
+
146
+ parameters:
147
+ level: 5
148
+ paths:
149
+ - src
150
+ excludePaths:
151
+ - src/vendor/*
152
+ - src/tests/*
153
+ treatPhpDocTypesAsCertain: false
154
+ ```
155
+
156
+ ---
157
+
158
+ ## WPackagist — free Composer repo for WordPress.org plugins
159
+
160
+ ```json
161
+ {
162
+ "repositories": [{
163
+ "type": "composer",
164
+ "url": "https://wpackagist.org",
165
+ "only": ["wpackagist-plugin/*", "wpackagist-theme/*"]
166
+ }],
167
+ "require": {
168
+ "wpackagist-plugin/advanced-custom-fields": "^6.0",
169
+ "wpackagist-plugin/wordpress-seo": ">=7.0",
170
+ "wpackagist-theme/twentytwentyfive": "*",
171
+ "composer/installers": "^2.0"
172
+ },
173
+ "extra": {
174
+ "installer-paths": {
175
+ "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
176
+ "web/app/themes/{$name}/": ["type:wordpress-theme"]
177
+ }
178
+ }
179
+ }
180
+ ```
181
+
182
+ The `only` filter is important — without it Composer queries WPackagist for every package lookup, making installs slow.
183
+
184
+ ---
185
+
186
+ ## SatisPress — private Composer repo for premium plugins
187
+
188
+ SatisPress is a WordPress plugin that wraps your premium plugin installs into a Composer repository. You host it on a dedicated WordPress site.
189
+
190
+ **Endpoint:** `https://your-satispress-site.com/satispress/packages.json`
191
+ **Auth:** HTTP Basic — API Key as username, literal `satispress` as password.
192
+
193
+ ### `composer.json` setup
194
+
195
+ ```json
196
+ {
197
+ "repositories": {
198
+ "satispress": {
199
+ "type": "composer",
200
+ "url": "https://your-satispress-site.com/satispress/"
201
+ }
202
+ },
203
+ "require": {
204
+ "satispress/gravityforms": "*",
205
+ "satispress/acf-pro": ">=6.0"
206
+ }
207
+ }
208
+ ```
209
+
210
+ ### `auth.json` (per machine, gitignored)
211
+
212
+ ```json
213
+ {
214
+ "http-basic": {
215
+ "your-satispress-site.com": {
216
+ "username": "<32-char-api-key>",
217
+ "password": "satispress"
218
+ }
219
+ }
220
+ }
221
+ ```
222
+
223
+ Or configure via CLI:
224
+ ```bash
225
+ composer config http-basic.your-satispress-site.com <API_KEY> satispress
226
+ ```
227
+
228
+ ### GitHub Actions — `auth.json` as secret
229
+
230
+ ```yaml
231
+ - name: Configure Composer auth
232
+ run: |
233
+ echo '${{ secrets.COMPOSER_AUTH_JSON }}' > auth.json
234
+ ```
235
+ Store the full `auth.json` contents as `COMPOSER_AUTH_JSON` in GitHub Secrets.
236
+
237
+ ### Package naming
238
+
239
+ Packages are named `satispress/<plugin-slug>` by default. Customize with the `satispress_vendor` filter in the SatisPress WordPress site.
240
+
241
+ ---
242
+
243
+ ## Combined `composer.json` (WPackagist + SatisPress + dev tools)
244
+
245
+ For a Bedrock-style project that manages WP core + premium plugins:
246
+
247
+ ```json
248
+ {
249
+ "name": "myorg/my-site",
250
+ "type": "project",
251
+ "repositories": {
252
+ "wpackagist": {
253
+ "type": "composer",
254
+ "url": "https://wpackagist.org",
255
+ "only": ["wpackagist-plugin/*", "wpackagist-theme/*"]
256
+ },
257
+ "satispress": {
258
+ "type": "composer",
259
+ "url": "https://packages.myorg.com/satispress/"
260
+ }
261
+ },
262
+ "require": {
263
+ "php": ">=8.1",
264
+ "roots/wordpress": "^6.7",
265
+ "composer/installers": "^2.0",
266
+ "wpackagist-plugin/wordpress-seo": ">=7.0",
267
+ "satispress/gravityforms": "^2.8"
268
+ },
269
+ "require-dev": {
270
+ "squizlabs/php_codesniffer": "^3.11",
271
+ "wp-coding-standards/wpcs": "^3.1",
272
+ "szepeviktor/phpstan-wordpress": "^2.0"
273
+ }
274
+ }
275
+ ```