@rolepod/wplab 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +21 -0
- package/CHANGELOG.md +394 -0
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/dist/bin/rolepod-wplab.d.ts +1 -0
- package/dist/bin/rolepod-wplab.js +66951 -0
- package/dist/bin/rolepod-wplab.js.map +1 -0
- package/dist/cpufeatures-FGCCZK75.node +0 -0
- package/dist/index.d.ts +3103 -0
- package/dist/index.js +66293 -0
- package/dist/index.js.map +1 -0
- package/dist/sshcrypto-GDFKS5G5.node +0 -0
- package/package.json +77 -0
- package/skills/wp-audit-security/SKILL.md +58 -0
- package/skills/wp-audit-woo/SKILL.md +44 -0
- package/skills/wp-edit-elementor/SKILL.md +44 -0
- package/skills/wp-execute-php/SKILL.md +59 -0
- package/skills/wp-health-check/SKILL.md +50 -0
- package/skills/wp-introspect/SKILL.md +48 -0
- package/skills/wp-migrate-dryrun/SKILL.md +48 -0
- package/skills/wp-pair-setup/SKILL.md +78 -0
- package/skills/wp-scaffold-block/SKILL.md +61 -0
- package/skills/wp-scaffold-plugin/SKILL.md +53 -0
- package/skills/wp-scaffold-theme/SKILL.md +43 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rolepod-wplab",
|
|
3
|
+
"displayName": "Rolepod WPLab",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Multi-target WordPress automation for AI agents — scaffold, audit, verify, safe ops via wp-cli + REST + scoped fs. Optional companion plugin unlocks execute-php + runtime introspection. MIT, rolepod ecosystem.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "nuttaruj",
|
|
8
|
+
"url": "https://github.com/nuttaruj"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/nuttaruj/rolepod-wplab",
|
|
11
|
+
"repository": "https://github.com/nuttaruj/rolepod-wplab",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"mcp",
|
|
15
|
+
"wordpress",
|
|
16
|
+
"wp-cli",
|
|
17
|
+
"automation",
|
|
18
|
+
"rolepod",
|
|
19
|
+
"ai-agents"
|
|
20
|
+
]
|
|
21
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@rolepod/wplab` are documented here. Follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format and [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
|
+
|
|
5
|
+
## [1.2.1] — 2026-05-26 — Path-2 polish
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- `rolepod_wp_connect_rest` `CREDENTIALS_MISSING` error now lists BOTH paths (companion Quick Start URL + manual `credentials add` command) so the AI can guide the user without guessing.
|
|
10
|
+
- `RestTarget.open` `REST_AUTH_FAILED` error includes the same two-path suggestion plus the setup-wizard URL on the target host.
|
|
11
|
+
- Both errors carry `setup_wizard_url` in `meta` for AI agents that prefer structured data over message text.
|
|
12
|
+
|
|
13
|
+
### Numbers
|
|
14
|
+
|
|
15
|
+
- MCP tools: **62** (unchanged).
|
|
16
|
+
- Tests: 141 passing.
|
|
17
|
+
|
|
18
|
+
## [1.2.0] — 2026-05-26 — One-click pair (Novamira-style setup UX)
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `rolepod_wp_pair { siteurl, pair_token }` — single MCP call that redeems a companion-issued pair token for a real WP Application Password (companion-minted under the issuing admin's user, named `wplab-pair-<timestamp>`). Stores credential in vault + opens a `RestTarget` in one shot.
|
|
23
|
+
- Companion endpoint **POST `/wp-json/wplab/v1/pair/generate`** (admin only, manage_options) — issues a 256-bit pair token, TTL 60 min, max 5 active per admin.
|
|
24
|
+
- Companion endpoint **POST `/wp-json/wplab/v1/pair/redeem`** (public, token-authed) — atomic single-use redeem; per-IP throttle (10 failed / hour).
|
|
25
|
+
- Companion `src/Security/PairToken.php` — SHA-256 hashed-at-rest tokens in `wp_options`, opportunistic sweep of expired rows.
|
|
26
|
+
- Companion `Tools → WPLab Setup` page extended with **"⚡ Quick Start"** section: button → mints pair token → renders ready-to-paste prompt that includes Claude Code / Cursor / Codex / Gemini install snippets + `rolepod_wp_pair` call with siteurl + pair_token baked in. One-click copy.
|
|
27
|
+
- New skill `skills/wp-pair-setup/SKILL.md` — instructs AI agents on the pair flow + failure modes + security notes.
|
|
28
|
+
|
|
29
|
+
### Schema additions
|
|
30
|
+
|
|
31
|
+
- `PairInputSchema` — siteurl https-only refine + pair_token regex `/^wplab_pair_[a-f0-9]{48}$/`.
|
|
32
|
+
- `PairOutputSchema` — target_id + siteurl + username + capabilities + companion_version + is_production + app_password_name + credential_stored.
|
|
33
|
+
|
|
34
|
+
### Security
|
|
35
|
+
|
|
36
|
+
- Pair token = SHA-256 hashed at rest, never returned by any GET endpoint.
|
|
37
|
+
- Single-use guarantee: `PairToken::redeem` deletes the wp_options row **before** acting on the payload — concurrent redeem attempts can't both succeed.
|
|
38
|
+
- TTL 60 min, post-redeem the App Password is the long-lived credential (revocable from `profile.php`).
|
|
39
|
+
- Pair generate requires admin (`manage_options`). Pair redeem rate-limited per IP via transient.
|
|
40
|
+
- App Password name `wplab-pair-<UTC-timestamp>` makes attribution + revocation trivial.
|
|
41
|
+
- Production guard unchanged — pair-minted credentials are subject to all the same `ProdGuard` checks on power tools.
|
|
42
|
+
- Companion `endpoints_enabled` master toggle still applies — pair endpoints respect it.
|
|
43
|
+
|
|
44
|
+
### Numbers
|
|
45
|
+
|
|
46
|
+
- **MCP tools**: 61 → 62 (+1: `rolepod_wp_pair`).
|
|
47
|
+
- **Companion REST endpoints**: 8 → 10 (+2: pair/generate, pair/redeem).
|
|
48
|
+
- **Skills**: 10 → 11 (+1: wp-pair-setup).
|
|
49
|
+
- **Unit + smoke tests**: 134 → 141 (+7 PairInput/Output schema tests).
|
|
50
|
+
|
|
51
|
+
### Notes
|
|
52
|
+
|
|
53
|
+
- Schema-freeze policy honored: every change is additive (new tool, new schemas, new endpoints).
|
|
54
|
+
- Companion-first install path is now the recommended quick-start. Manual setup path (App Password + npm install + claude mcp add + credentials add) preserved on the same wizard page for users on CLIs without a wplab plugin.
|
|
55
|
+
|
|
56
|
+
## [1.1.0] — 2026-05-26 — Parity + lead expansion (Tier A/B/C/D)
|
|
57
|
+
|
|
58
|
+
### Added — Tier A (close Novamira gaps)
|
|
59
|
+
|
|
60
|
+
- `rolepod_wp_divi_read` / `rolepod_wp_divi_write` — Divi Builder pages (post_content shortcodes + `_et_pb_use_builder` flag).
|
|
61
|
+
- `rolepod_wp_oxygen_read` / `rolepod_wp_oxygen_write` — Oxygen Builder (`ct_builder_shortcodes` post meta).
|
|
62
|
+
- `rolepod_wp_bricks_write` — extends Bricks adapter with page / header / footer element-tree writes.
|
|
63
|
+
- `rolepod_wp_yoast_write` — Yoast SEO post meta (focus_keyword / meta_description / title / canonical / noindex).
|
|
64
|
+
- `rolepod_wp_rankmath_write` — Rank Math SEO post meta (mirrors Yoast surface).
|
|
65
|
+
- `rolepod_wp_wpml_write` — set_post_language / link_translations / duplicate_for_translation ops.
|
|
66
|
+
|
|
67
|
+
### Added — Tier B (exceed Novamira surface)
|
|
68
|
+
|
|
69
|
+
- `rolepod_wp_forms_read` / `rolepod_wp_forms_write` — unified Gravity / Contact Form 7 / WPForms adapter with auto-detect.
|
|
70
|
+
- `rolepod_wp_cron_tool` — list / run / delete WP-Cron events.
|
|
71
|
+
- `rolepod_wp_cache_tool` — inspect object cache + transient counts; flush_object / flush_transients ops.
|
|
72
|
+
- `rolepod_wp_mail_test` — send test email via wp_mail() (companion execute-php preferred, wp-cli `wp eval` fallback).
|
|
73
|
+
- `rolepod_wp_clone` — composite: db export+import + wp-content sync + url search-replace + plugin version sync.
|
|
74
|
+
- `rolepod_wp_backup_create` / `rolepod_wp_backup_restore` — db dump + wp-content manifest snapshots.
|
|
75
|
+
|
|
76
|
+
### Added — Tier C (setup UX parity)
|
|
77
|
+
|
|
78
|
+
- `rolepod-wplab init` — interactive 5-step wizard (App Password + REST probe + handshake + credential store + starter profile).
|
|
79
|
+
- `rolepod-wplab companion install --target=<host>` — probe + emit copy-paste wp-cli installer command.
|
|
80
|
+
- `rolepod-wplab companion status --target=<host>` — handshake check + capability dump.
|
|
81
|
+
- Companion plugin: new **Tools → WPLab Setup** wizard page with App Password + MCP install copy-paste blocks.
|
|
82
|
+
|
|
83
|
+
### Added — Tier D (moat extend)
|
|
84
|
+
|
|
85
|
+
- `rolepod_wp_user_session_list` — enumerate active user sessions via `wp_usermeta.session_tokens` (security audit).
|
|
86
|
+
- `rolepod_wp_rest_dump` — enumerate every registered REST route (optional `filter_namespace`).
|
|
87
|
+
- `rolepod_wp_scaffold_pattern` — scaffolds a block pattern PHP file inside a theme or plugin.
|
|
88
|
+
- `rolepod_wp_diagnose` — non-destructive sweep: plugin_conflict_probe / slow_queries / large_options / broken_images / php_errors.
|
|
89
|
+
|
|
90
|
+
### Changed
|
|
91
|
+
|
|
92
|
+
- `AllowList.ts` — added wp-cli READ_ONLY entries: `transient list`, `cache type`, `user session list`.
|
|
93
|
+
- `AllowList.ts` — added wp-cli DESTRUCTIVE entries: `cron event run` / `delete` / `schedule`, `cache flush`, `transient delete` / `delete-expired`, `db export` / `import`, `search-replace`, `wpml`, `gf`, `user session destroy`.
|
|
94
|
+
- `tests/smoke/mcp-handshake.test.ts` — expected tool count 41 → 61.
|
|
95
|
+
|
|
96
|
+
### Numbers
|
|
97
|
+
|
|
98
|
+
- **MCP tools**: 41 → 61 (+20).
|
|
99
|
+
- **Adapters**: 8 (Elementor / Woo / ACF / Bricks / WPML / Yoast / RankMath) + 3 new dir (Divi / Oxygen / Forms).
|
|
100
|
+
- **CLI subcommands**: 5 → 7 (added `init`, `companion`).
|
|
101
|
+
- **Companion REST endpoints**: 8 (unchanged).
|
|
102
|
+
- **Unit + smoke tests**: 117 passing.
|
|
103
|
+
|
|
104
|
+
### Notes
|
|
105
|
+
|
|
106
|
+
- Schema-freeze policy honored: every new tool is **additive** (new tool names). No existing input/output schema fields changed.
|
|
107
|
+
- Forms adapter `list_entries` is wired for Gravity Forms in v1.1; CF7 / WPForms entries land in plugin-private tables — adapter returns empty for those scopes in v1.1 (planned for v1.2 once both expose entry REST routes consistently).
|
|
108
|
+
- `wp_clone` `wp_content` scope copies top-level entries only — full deep tree sync (large media) is deferred to v1.2 with a companion `fs-rsync` endpoint.
|
|
109
|
+
- `wp_backup_restore` `wp_content` scope is manifest-verify only in v1.1; deep restore requires batch fs-write API (v1.2).
|
|
110
|
+
|
|
111
|
+
## [1.0.0] — 2026-05-25 — Stable (schema-frozen)
|
|
112
|
+
|
|
113
|
+
### Schema-freeze promise
|
|
114
|
+
|
|
115
|
+
All MCP tool **names** and **required input fields** locked. Breaking changes require a **major bump**. Adding optional input fields, adding output fields, adding new tools = minor. Bug fixes + dep bumps = patch.
|
|
116
|
+
|
|
117
|
+
The frozen schema:
|
|
118
|
+
- **46 MCP tools** with `rolepod_wp_*` prefix (connect + lifecycle + atomic + typed CRUD + adapters + composites + memory + companion-gated power).
|
|
119
|
+
- Schema source: `src/schema/tools.ts` (zod). Exported to `dist/schemas/tools.json` on build.
|
|
120
|
+
- Replay bundle format `v1` (`src/bin/replay.ts`).
|
|
121
|
+
- Companion REST namespace `/wp-json/wplab/v1/` with 8 endpoints.
|
|
122
|
+
|
|
123
|
+
### Locked
|
|
124
|
+
|
|
125
|
+
- Tool names + required fields.
|
|
126
|
+
- Profile names: strict / personal / power.
|
|
127
|
+
- Target kinds: local / rest / ssh / docker.
|
|
128
|
+
- Allow-list categories + never-allowed list (W-005).
|
|
129
|
+
- Filesystem scope rules (W-006).
|
|
130
|
+
- DB SELECT-only guard (W-007).
|
|
131
|
+
- Production guard semantics (W-008).
|
|
132
|
+
- Credential vault layout (W-018).
|
|
133
|
+
- Memory directory layout (W-028).
|
|
134
|
+
- Replay bundle JSON shape.
|
|
135
|
+
|
|
136
|
+
### Not locked
|
|
137
|
+
|
|
138
|
+
- Internal Target interface methods may grow (additive only).
|
|
139
|
+
- Composite implementations may improve.
|
|
140
|
+
- Adapter slate may expand (new plugins post-v1.0 are minor bumps).
|
|
141
|
+
- Companion v1.0+ may add new endpoints (additive).
|
|
142
|
+
|
|
143
|
+
### Pairs with
|
|
144
|
+
|
|
145
|
+
- `rolepod-wplab-companion` **v1.0** — schema-frozen alongside; audit log format frozen, capability map locked.
|
|
146
|
+
|
|
147
|
+
### Maintainer next actions (post-tag)
|
|
148
|
+
|
|
149
|
+
- npm publish `@rolepod/wplab`.
|
|
150
|
+
- Submit `rolepod-wplab-companion` to wordpress.org plugin directory (gated on WP review).
|
|
151
|
+
- External security audit per `SECURITY.md` "v1.0 audit scope" section.
|
|
152
|
+
|
|
153
|
+
## [0.5.0] — 2026-05-25 — OSS launch
|
|
154
|
+
|
|
155
|
+
### Added — Governance + docs
|
|
156
|
+
|
|
157
|
+
- **CONTRIBUTING.md** — clean-room policy (W-002), quality gates, contribution checklist for new tools / adapters / companion endpoints, single-backend rule (W-011), DCO sign-off.
|
|
158
|
+
- **CODE_OF_CONDUCT.md** — Contributor Covenant v2.1.
|
|
159
|
+
- **SECURITY.md** — supported-versions matrix, 90-day private disclosure window, threat model for Node MCP + companion, in-scope items for v1.0 external audit.
|
|
160
|
+
- **docs/MIGRATION-FROM-NOVAMIRA.md** — feature parity matrix, coexistence flow (Phase 0 → 4), key behavioral differences, "use which" honest framing.
|
|
161
|
+
- **.github/ISSUE_TEMPLATE/{bug_report,feature_request}.md** — structured intake.
|
|
162
|
+
|
|
163
|
+
### Pairs with
|
|
164
|
+
|
|
165
|
+
- `rolepod-wplab-companion` v0.2 (unchanged for v0.5).
|
|
166
|
+
|
|
167
|
+
### Tests
|
|
168
|
+
|
|
169
|
+
- 117 unit + smoke green. 46 MCP tools. `claude plugin validate ./ --strict` pass.
|
|
170
|
+
|
|
171
|
+
### Not in v0.5 (deferred to v1.0)
|
|
172
|
+
|
|
173
|
+
- npm publish to `@rolepod/wplab` — requires npm org claim + publish workflow.
|
|
174
|
+
- wordpress.org plugin directory submission for companion — requires WP review.
|
|
175
|
+
- Astro docs site (RECIPES.md remains the primary doc surface).
|
|
176
|
+
- Real replay tool dispatch (currently stub).
|
|
177
|
+
- External security audit.
|
|
178
|
+
- Conformance test suite for 3rd-party adapters.
|
|
179
|
+
|
|
180
|
+
## [0.4.0] — 2026-05-25
|
|
181
|
+
|
|
182
|
+
### Added — Polish
|
|
183
|
+
|
|
184
|
+
- **Replay bundle format v1.** Schema in `src/bin/replay.ts`. CLI: `rolepod-wplab replay <bundle.json>`. v0.4 stub-dispatches calls (logs only); v0.5 wires actual in-process MCP CallTool dispatch loop.
|
|
185
|
+
- **Dockerfile** for ghcr.io publish target. Multi-stage (build node20 → runtime node20-alpine). Entrypoint = `rolepod-wplab serve`.
|
|
186
|
+
- **GitHub Actions CI** (`.github/workflows/ci.yml`) — Node 20+22 × ubuntu+macos matrix; typecheck + build + test + lint + prettier + docker build (no push).
|
|
187
|
+
- **docs/RECIPES.md** — 10 concrete end-to-end recipes (connect local/remote, scaffold block, audit multi-site, migrate plugins, hook debug, bulk Woo update, memory recall, execute-php, docker fixture).
|
|
188
|
+
|
|
189
|
+
### Changed
|
|
190
|
+
|
|
191
|
+
- `rolepod-wplab` CLI usage line lists all subcommands: serve | doctor | credentials | memory | replay | smoke.
|
|
192
|
+
|
|
193
|
+
### Not yet implemented (deferred to v0.5)
|
|
194
|
+
|
|
195
|
+
- Replay actually executes tool calls (currently stubs to logs).
|
|
196
|
+
- Docs site (Astro). RECIPES.md serves as v0.4 doc surface.
|
|
197
|
+
- WooCommerce optional pack (existing adapter writes cover most use cases).
|
|
198
|
+
- Adapter test framework with real fixture coverage.
|
|
199
|
+
|
|
200
|
+
## [0.3.0] — 2026-05-25
|
|
201
|
+
|
|
202
|
+
### Added — Multi-target + cross-target composites + SEO/i18n adapters
|
|
203
|
+
|
|
204
|
+
**New target kinds (W-009):**
|
|
205
|
+
- `SshTarget` — node-ssh based. Supports private_key_path or password auth. wp-cli via ssh exec; fileRead/fileWrite via SFTP.
|
|
206
|
+
- `DockerTarget` — dockerode based. `docker exec` per call. File ops via stdin-piped tee. Demuxes docker stream multiplex header.
|
|
207
|
+
- `factory.openTarget` handles 4 kinds: local | rest | ssh | docker.
|
|
208
|
+
|
|
209
|
+
**New MCP tools (8 — total 46, was 34 in v0.2):**
|
|
210
|
+
- `rolepod_wp_connect_ssh { host, user, wp_path, port?, private_key_path?, password? }`
|
|
211
|
+
- `rolepod_wp_connect_docker { container_name, wp_path?, docker_host?, docker_socket_path? }`
|
|
212
|
+
- `rolepod_wp_audit_many { target_ids[], report_format? }` — fan out audit across N targets, consolidate.
|
|
213
|
+
- `rolepod_wp_migrate_data { source_target_id, dest_target_id, scope, allow_destructive:true, confirm? }` — v0.3 supports plugin_versions only (install/upgrade dest to match source).
|
|
214
|
+
- `rolepod_wp_wpml_read { target_id, scope, domain?, post_id? }` — languages / string_translations / post_translations.
|
|
215
|
+
- `rolepod_wp_yoast_read { target_id, scope, post_id? }` — post_meta / settings.
|
|
216
|
+
- `rolepod_wp_rankmath_read { target_id, scope, post_id? }` — post_meta / settings.
|
|
217
|
+
|
|
218
|
+
**Adapters (3 new):**
|
|
219
|
+
- `wpml/read` — supportedRange 4.5 — 4.7.
|
|
220
|
+
- `yoast/read` — supportedRange 21.0 — 23.5.
|
|
221
|
+
- `rankmath/read` — supportedRange 1.0.200 — 1.0.220.
|
|
222
|
+
|
|
223
|
+
### Deps
|
|
224
|
+
|
|
225
|
+
- `@types/dockerode` added to devDependencies.
|
|
226
|
+
- `node-ssh` + `dockerode` (optionalDependencies from v0.0) now actually pulled.
|
|
227
|
+
|
|
228
|
+
### Pairs with
|
|
229
|
+
|
|
230
|
+
- `rolepod-wplab-companion` v0.2 (unchanged for v0.3).
|
|
231
|
+
|
|
232
|
+
### Tests
|
|
233
|
+
|
|
234
|
+
- 117 unit + smoke green (smoke asserts 46 tools).
|
|
235
|
+
- claude plugin validate --strict pass.
|
|
236
|
+
- Lint + prettier + typecheck clean.
|
|
237
|
+
|
|
238
|
+
## [0.2.0] — 2026-05-25
|
|
239
|
+
|
|
240
|
+
### Added — Companion online + Memory + Power tools
|
|
241
|
+
|
|
242
|
+
**Memory (W-028):**
|
|
243
|
+
- `MemoryStore` — per-site file-based storage at `~/.config/rolepod-wplab/memory/<site-slug>/` (mode 0700 dir, 0600 files). Layout: meta.json + site.md + notes.md (append-only) + conventions.md (versioned append) + runbooks/*.md.
|
|
244
|
+
- `rolepod_wp_memory_recall { target_id, query?, kind? }` — substring + kind filter.
|
|
245
|
+
- `rolepod_wp_memory_note { target_id, content, kind?, runbook_name?, tags? }` — append note / version convention / replace runbook.
|
|
246
|
+
- `rolepod_wp_memory_list { target_id }` — metadata-only file listing.
|
|
247
|
+
- CLI: `rolepod-wplab memory show | list | clear | export`.
|
|
248
|
+
|
|
249
|
+
**Companion bridge + power tools (W-003R, W-004R):**
|
|
250
|
+
- `src/companion/Bridge.ts` — handshake + session token mgmt + AST pre-screen + auto-refresh on 401.
|
|
251
|
+
- `src/safety/AstScreen.ts` — token-blocklist screen (defence in depth with companion v0.1+ PHP-side screen). Rejects eval/assert/system/exec/shell_exec/proc_open/popen/pcntl_*/dl/backtick/dynamic-include.
|
|
252
|
+
- `rolepod_wp_execute_php { target_id, payload, timeout_ms?, confirm:true }` — requires `ROLEPOD_WPLAB_PROFILE=power`.
|
|
253
|
+
- `rolepod_wp_introspect { target_id, scope, include_values? }`.
|
|
254
|
+
- `rolepod_wp_hook_state { target_id, hook, kind? }` — specialized wrapper over introspect(scope=hooks).
|
|
255
|
+
|
|
256
|
+
**Adapter writes + Bricks (W-023 extended):**
|
|
257
|
+
- `elementor/write.updatePageData` — auto-backup `_elementor_data` before overwrite.
|
|
258
|
+
- `woocommerce/write.updateProduct` + `bulkUpdatePrices` (via /wc/v3/products/batch).
|
|
259
|
+
- `acf/write.setPostMeta` — ACF Pro REST first, wp-cli fallback.
|
|
260
|
+
- `bricks/read` adapter — listPages + getPage (parses `_bricks_page_content_2`). supportedRange 1.8 — 1.10.
|
|
261
|
+
- 4 new MCP tools: `wp_elementor_write`, `wp_woo_write`, `wp_acf_write`, `wp_bricks_read`. All writes enforce production guard.
|
|
262
|
+
|
|
263
|
+
**Composites (5 total):**
|
|
264
|
+
- `rolepod_wp_scaffold_block` — generates block.json + index.js + render.php (or save) + style.css.
|
|
265
|
+
- `rolepod_wp_scaffold_plugin` — main PHP + readme + uninstall + optional rest_endpoint/admin_page/cli_command stubs.
|
|
266
|
+
- `rolepod_wp_scaffold_theme` — block-theme skeleton (style.css + theme.json + functions.php + templates).
|
|
267
|
+
- `rolepod_wp_audit_security` — chains wp-cli checks + writes audit-report.md/.json.
|
|
268
|
+
- `rolepod_wp_migrate_dryrun` — diffs two targets across plugin_versions / options / users / posts.
|
|
269
|
+
|
|
270
|
+
**Shipped skills (6 new — total 10):**
|
|
271
|
+
- `wp-execute-php` (companion-gated, power profile required)
|
|
272
|
+
- `wp-introspect` (companion-gated)
|
|
273
|
+
- `wp-edit-elementor` (adapter)
|
|
274
|
+
- `wp-audit-woo` (adapter composite)
|
|
275
|
+
- `wp-scaffold-theme`
|
|
276
|
+
- `wp-migrate-dryrun`
|
|
277
|
+
|
|
278
|
+
**MCP tools: 34 total** (was 19 in v0.1). All registered + tools/list smoke updated to assert exact list.
|
|
279
|
+
|
|
280
|
+
### Changed
|
|
281
|
+
|
|
282
|
+
- `Target` interface: `TargetKind` unchanged but bridge layer now exercises `Target.rest()` for companion communication on all target kinds (RestTarget today; v0.3 SSH/Docker via companion remote install).
|
|
283
|
+
- `loadProfile()` recognizes `power` profile (was placeholder in v0.1 schema).
|
|
284
|
+
|
|
285
|
+
### Pairs with
|
|
286
|
+
|
|
287
|
+
- `rolepod-wplab-companion` v0.2 — adds `/wp-cli` (bundled wp-cli proxy), `/fs-read`, `/fs-write`, `/php-session`, `/request-observer`. `execute-php` default-enabled.
|
|
288
|
+
|
|
289
|
+
### Tests
|
|
290
|
+
|
|
291
|
+
- 117 unit + smoke tests green (memory 17 + AstScreen 13 added).
|
|
292
|
+
- `claude plugin validate ./ --strict` passes.
|
|
293
|
+
- Lint + prettier + typecheck all clean.
|
|
294
|
+
|
|
295
|
+
## [0.1.0] — 2026-05-25
|
|
296
|
+
|
|
297
|
+
### Added — PoC complete (Path C foundation)
|
|
298
|
+
|
|
299
|
+
**Runtime layer:**
|
|
300
|
+
- `RestTarget` (W-027) — remote WordPress via HTTPS REST + optional companion. No host wp-cli, no SSH needed. Closes shared-hosting gap.
|
|
301
|
+
- `restClient` — Basic-Auth App Password, content-type sniffing, `?rest_route=` fallback for permalink-disabled WP, AbortController timeout, redacts auth from error context.
|
|
302
|
+
- `Target` interface gains `companion: CompanionStatus | null` field. `executePhp` / `introspect` are optional methods (companion-gated).
|
|
303
|
+
- Companion handshake at every target-open. 200 + power profile + non-prod → power tools available. Else → power tools unregistered.
|
|
304
|
+
|
|
305
|
+
**Credentials (W-018, W-027):**
|
|
306
|
+
- Vault interface: `add` / `get` / `list` / `remove` / `touch`.
|
|
307
|
+
- `KeychainVault` — macOS Keychain via `security` binary + sidecar metadata JSON.
|
|
308
|
+
- `FileVault` — JSON at mode 0600 (Linux + portable fallback).
|
|
309
|
+
- `makeVault()` — auto-detects platform; `ROLEPOD_WPLAB_VAULT=file|keychain` override.
|
|
310
|
+
- `canonicalizeSite()` — lowercase hostname extraction.
|
|
311
|
+
- `Credential` type carries `appPassword` (raw secret, never serialized to MCP responses or audit log).
|
|
312
|
+
- `prompt.ts`: `ask` / `askSecret` (raw-mode no-echo) / `confirm` — no extra deps.
|
|
313
|
+
- CLI subcommand `rolepod-wplab credentials <add|list|show|remove|test> [site]`.
|
|
314
|
+
|
|
315
|
+
**MCP tools — 19 total (was 5 in v0.0):**
|
|
316
|
+
|
|
317
|
+
Connectivity + lifecycle:
|
|
318
|
+
- `rolepod_wp_connect_local { path }`
|
|
319
|
+
- `rolepod_wp_connect_rest { url, credential_ref?, require_companion? }` (NEW)
|
|
320
|
+
- `rolepod_wp_disconnect { target_id }` (NEW)
|
|
321
|
+
|
|
322
|
+
Atomic surface:
|
|
323
|
+
- `rolepod_wp_cli_run { target_id, args, allow_destructive?, timeout_ms? }`
|
|
324
|
+
- `rolepod_wp_health_check { target_id }`
|
|
325
|
+
- `rolepod_wp_file_read { target_id, path }`
|
|
326
|
+
- `rolepod_wp_file_write { target_id, path, content, mode?, backup?, confirm_unsafe_path? }`
|
|
327
|
+
- `rolepod_wp_post_get { target_id, id, context?, type? }` (NEW)
|
|
328
|
+
- `rolepod_wp_post_list { target_id, type?, per_page?, page?, search?, status?, ... }` (NEW)
|
|
329
|
+
- `rolepod_wp_post_create { target_id, title, content, status?, ... }` (NEW)
|
|
330
|
+
- `rolepod_wp_post_update { target_id, id, title?, content?, status?, ... }` (NEW)
|
|
331
|
+
- `rolepod_wp_option_get { target_id, name }` (NEW)
|
|
332
|
+
- `rolepod_wp_option_set { target_id, name, value, confirm? }` (NEW)
|
|
333
|
+
- `rolepod_wp_user_list { target_id, per_page?, page?, search?, role? }` (NEW)
|
|
334
|
+
- `rolepod_wp_db_query { target_id, sql, allow_write?, confirm? }` (NEW)
|
|
335
|
+
- `rolepod_wp_rest_request { target_id, method, path, query?, body?, headers? }` (NEW)
|
|
336
|
+
|
|
337
|
+
Adapter-backed (read-only v0.1, W-023):
|
|
338
|
+
- `rolepod_wp_elementor_read { target_id, page_id?, type?, per_page? }` (NEW)
|
|
339
|
+
- `rolepod_wp_woo_read { target_id, scope, group?, per_page?, search?, status? }` (NEW)
|
|
340
|
+
- `rolepod_wp_acf_read { target_id, scope, group_key?, post_id? }` (NEW)
|
|
341
|
+
|
|
342
|
+
**Adapters (src/adapters/):**
|
|
343
|
+
- `_contract.ts` — `Adapter<TRead, TWrite>` interface + `AdapterUnavailableError`.
|
|
344
|
+
- `elementor/read` — listPages (REST), getPage (wp-cli post meta; RestTarget needs companion v0.2). supportedRange: 3.18 — 3.22.
|
|
345
|
+
- `woocommerce/read` — products, orders, settings_groups, settings_in_group, shipping_zones, payment_gateways via `/wc/v3` REST. supportedRange: 8.0 — 9.4.
|
|
346
|
+
- `acf/read` — fieldGroups, fieldsInGroup, postMeta via wp-cli + ACF Pro REST fallback. supportedRange: 6.0 — 6.3.
|
|
347
|
+
|
|
348
|
+
**Safety:**
|
|
349
|
+
- `DbGuard` (W-007) — SELECT/SHOW/DESCRIBE/DESC/EXPLAIN allow-list. Strips leading comments + handles `WITH ... SELECT` (CTE). `DbWriteBlockedError` on violation.
|
|
350
|
+
- All write tools enforce `ProdGuard` (W-008) unless `confirm: true`.
|
|
351
|
+
|
|
352
|
+
**Plugin layout (Claude Code, verified against https://code.claude.com/docs/en/plugins-reference + /skills):**
|
|
353
|
+
- `.claude-plugin/plugin.json` — metadata only (NO inline `mcpServers`; that lives in `.mcp.json`).
|
|
354
|
+
- `.mcp.json` at plugin root — declares MCP server pointing at `${CLAUDE_PLUGIN_ROOT}/dist/bin/rolepod-wplab.js`.
|
|
355
|
+
- `skills/wp-health-check/SKILL.md`
|
|
356
|
+
- `skills/wp-scaffold-block/SKILL.md`
|
|
357
|
+
- `skills/wp-scaffold-plugin/SKILL.md`
|
|
358
|
+
- `skills/wp-audit-security/SKILL.md`
|
|
359
|
+
- `claude plugin validate ./ --strict` passes.
|
|
360
|
+
|
|
361
|
+
Cursor + Codex + Gemini manifests NOT shipped this release — schemas not yet verified per SCHEMA-BOUND-file policy. Deferred to v0.5.
|
|
362
|
+
|
|
363
|
+
**Tests — 87 green:**
|
|
364
|
+
- `tests/unit/server.test.ts` (18) — server boot + AllowList + ProdGuard + FsScope
|
|
365
|
+
- `tests/unit/TargetRegistry.test.ts` (8) — lifecycle + idle close + collision
|
|
366
|
+
- `tests/unit/profile-load.test.ts` (6) — env / file / malformed
|
|
367
|
+
- `tests/unit/stripPhpNoise.test.ts` (9)
|
|
368
|
+
- `tests/unit/credentials.test.ts` (16) — canonicalize + FileVault round-trip + permissions + corruption
|
|
369
|
+
- `tests/unit/restClient.test.ts` (12) — https-only + auth header + URL form fallback + timeout + redaction + query encoding
|
|
370
|
+
- `tests/unit/DbGuard.test.ts` (15) — SELECT/SHOW/DESC/EXPLAIN allow + CTE + INSERT/UPDATE/DELETE/DROP/TRUNCATE/ALTER block + comments
|
|
371
|
+
- `tests/smoke/mcp-handshake.test.ts` (3) — spawn dist + JSON-RPC + tools/list asserts 19 tools
|
|
372
|
+
|
|
373
|
+
### Changed
|
|
374
|
+
|
|
375
|
+
- `Target.kind` type now includes `'rest'`.
|
|
376
|
+
- `runtime/wpCli.ts` adds `stripPhpNoise()` filter for wp-cli 2.12 on PHP 8.4 deprecation noise.
|
|
377
|
+
- `wp_health_check` DB probe switched from `wp db check` (needs host mysqlcheck) to `wp option get siteurl` (PHP mysqli only).
|
|
378
|
+
|
|
379
|
+
### Pairs with
|
|
380
|
+
|
|
381
|
+
- `rolepod-wplab-companion` v0.1 — optional WP plugin providing `/wp-json/wplab/v1/{handshake,introspect,execute-php}` endpoints. execute-php DISABLED by default in v0.1.
|
|
382
|
+
|
|
383
|
+
## [0.0.0] — 2026-05-25
|
|
384
|
+
|
|
385
|
+
### Added — personal-use scaffold
|
|
386
|
+
|
|
387
|
+
- Repo plumbing: TypeScript + tsup + vitest + oxlint + prettier.
|
|
388
|
+
- MCP server skeleton (stdio).
|
|
389
|
+
- `LocalTarget` runtime (wp-cli + REST stub + scoped fs).
|
|
390
|
+
- 5 atomic tools.
|
|
391
|
+
- Safety primitives: AllowList + FsScope + ProdGuard.
|
|
392
|
+
- 3-profile loader (`strict` / `personal` / `power` slot).
|
|
393
|
+
- Docker WP fixture (`tests/fixtures/`) for local dogfood.
|
|
394
|
+
- 44 unit + smoke tests.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nuttaruj
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# rolepod-wplab
|
|
2
|
+
|
|
3
|
+
**Status:** v0.1.0 — PoC complete (Path C foundation). Not yet published to npm; use locally via `npm link` or `claude --plugin-dir`.
|
|
4
|
+
|
|
5
|
+
Novamira-class WordPress operations toolkit for AI coding agents — default-safe wp-cli + REST + scoped filesystem, opt-in companion plugin ([`rolepod-wplab-companion`](https://github.com/nuttaruj/rolepod-wplab-companion)) for `execute-php` + runtime introspection. MIT, sibling of [rolepod-uiproof](https://github.com/nuttaruj/rolepod-uiproof) in the rolepod ecosystem.
|
|
6
|
+
|
|
7
|
+
## Two layers
|
|
8
|
+
|
|
9
|
+
| Layer | Install | Capability |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| **Default** | `claude --plugin-dir ./rolepod-wplab` (or marketplace once v0.5) | wp-cli + REST + scoped fs + 19 MCP tools (3 adapters for Elementor / WooCommerce / ACF read) |
|
|
12
|
+
| **Power** (opt-in) | + install [`rolepod-wplab-companion`](https://github.com/nuttaruj/rolepod-wplab-companion) WP plugin + `ROLEPOD_WPLAB_PROFILE=power` | adds `execute-php`, `introspect`, adapter writes (v0.2+) |
|
|
13
|
+
|
|
14
|
+
## Quick start (local dev)
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git clone https://github.com/nuttaruj/rolepod-wplab.git
|
|
18
|
+
cd rolepod-wplab
|
|
19
|
+
npm install
|
|
20
|
+
npm run build
|
|
21
|
+
|
|
22
|
+
# Test with Claude Code:
|
|
23
|
+
claude --plugin-dir ./
|
|
24
|
+
|
|
25
|
+
# Or register globally:
|
|
26
|
+
npm link
|
|
27
|
+
claude mcp add wplab -- rolepod-wplab
|
|
28
|
+
|
|
29
|
+
# Verify:
|
|
30
|
+
rolepod-wplab doctor
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Connecting to a WP target
|
|
34
|
+
|
|
35
|
+
**Local install** (filesystem path):
|
|
36
|
+
```
|
|
37
|
+
> "เชื่อม WP ที่ /Users/me/Sites/my-wp"
|
|
38
|
+
Lead → rolepod_wp_connect_local { path: "/Users/me/Sites/my-wp" }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Remote site** (REST + App Password):
|
|
42
|
+
```bash
|
|
43
|
+
# 1. WP admin → Users → Profile → Application Passwords → name "rolepod-wplab" → copy
|
|
44
|
+
# 2. Store locally (never echoed to chat):
|
|
45
|
+
rolepod-wplab credentials add walnutztudio.com
|
|
46
|
+
# Username: admin
|
|
47
|
+
# Application Password: ****
|
|
48
|
+
# ✓ stored in keychain
|
|
49
|
+
```
|
|
50
|
+
```
|
|
51
|
+
> "เชื่อม walnutztudio.com"
|
|
52
|
+
Lead → rolepod_wp_connect_rest { url: "https://walnutztudio.com" }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 19 MCP tools available
|
|
56
|
+
|
|
57
|
+
**Connectivity:** `connect_local`, `connect_rest`, `disconnect`, `health_check`
|
|
58
|
+
**wp-cli passthrough:** `cli_run` (allow-listed)
|
|
59
|
+
**REST CRUD:** `post_{get,list,create,update}`, `user_list`, `rest_request`
|
|
60
|
+
**Options:** `option_{get,set}`
|
|
61
|
+
**Database:** `db_query` (SELECT-only by default)
|
|
62
|
+
**Filesystem:** `file_{read,write}` (scoped to `wp-content/{themes,plugins,uploads}` + `wp-config.php`)
|
|
63
|
+
**Adapters (read):** `elementor_read`, `woo_read`, `acf_read`
|
|
64
|
+
|
|
65
|
+
All prefixed `rolepod_wp_*`. Schemas in `src/schema/tools.ts`.
|
|
66
|
+
|
|
67
|
+
## Safety defaults
|
|
68
|
+
|
|
69
|
+
- **Allow-list** wp-cli (W-005) — `db reset`, `db drop`, `core multisite-convert` never run from MCP.
|
|
70
|
+
- **SELECT-only** DB queries (W-007) by default; `allow_write: true` + `confirm: true` on prod.
|
|
71
|
+
- **Scoped filesystem writes** (W-006) — `wp-content/{themes,plugins,uploads}` + `wp-config.php` only.
|
|
72
|
+
- **Production guard** (W-008) — siteurl glob match against `ROLEPOD_WPLAB_PROD_HOSTS`; all write tools require `confirm: true` on match.
|
|
73
|
+
- **HTTPS-only** RestTarget (W-017) — App Password never travels plaintext.
|
|
74
|
+
- **Credentials in OS keychain** (W-018) — never in chat history, never in audit log.
|
|
75
|
+
|
|
76
|
+
Power tools (with companion + `power` profile) add:
|
|
77
|
+
- **AST screen** for execute-php payloads (Node-side + companion-side, defence in depth).
|
|
78
|
+
- **Production-block unconditional** for execute-php — no override exists.
|
|
79
|
+
- **Append-only audit log** for every execute-php call (success + rejection).
|
|
80
|
+
|
|
81
|
+
## Skills (4 in v0.1)
|
|
82
|
+
|
|
83
|
+
- `/rolepod-wplab:wp-health-check` — diagnostic snapshot
|
|
84
|
+
- `/rolepod-wplab:wp-scaffold-block` — Gutenberg block scaffold (composite lands v0.2)
|
|
85
|
+
- `/rolepod-wplab:wp-scaffold-plugin` — plugin skeleton (composite lands v0.2)
|
|
86
|
+
- `/rolepod-wplab:wp-audit-security` — CVE + outdated + perms audit (composite lands v0.2)
|
|
87
|
+
|
|
88
|
+
v0.2 adds: `/wp-execute-php`, `/wp-introspect`, `/wp-edit-elementor`, `/wp-audit-woo`, `/wp-scaffold-theme`, `/wp-migrate-dryrun`.
|
|
89
|
+
|
|
90
|
+
## Sibling repos
|
|
91
|
+
|
|
92
|
+
- [`rolepod-wplab-companion`](https://github.com/nuttaruj/rolepod-wplab-companion) — optional WP plugin for runtime PHP context.
|
|
93
|
+
- [`rolepod-uiproof`](https://github.com/nuttaruj/rolepod-uiproof) — UI / mobile automation sibling.
|
|
94
|
+
|
|
95
|
+
## Design
|
|
96
|
+
|
|
97
|
+
Path C stance (W-026): same capability ceiling as Novamira, default-safe posture, opt-in companion for runtime PHP context. Differentiation matrix + decision log in the [internal design brief](./brief/) (gitignored, maintainer-only — reconstructable from conversation context if lost).
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT — see [LICENSE](./LICENSE). Clean-room from [Novamira](https://github.com/use-novamira/novamira) (AGPL-3.0); no Novamira code was read or copied.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|