@ai-kits/wp-ag-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ANTIGRAVITY-README.md +47 -0
- package/CONTRIBUTING.md +122 -0
- package/README.md +135 -0
- package/STRUCTURE.md +200 -0
- package/agents/wordpress-expert.md +36 -0
- package/agents/wp-frontend-expert.md +21 -0
- package/bin/antigravity-agent.js +159 -0
- package/docs/authoring-guide.md +56 -0
- package/docs/compatibility-policy.md +18 -0
- package/docs/packaging.md +26 -0
- package/docs/principles.md +7 -0
- package/docs/skill-set-v1.md +21 -0
- package/docs/upstream-sync.md +52 -0
- package/package.json +47 -0
- package/rules/GEMINI.md +273 -0
- package/shared/references/.gitkeep +1 -0
- package/shared/references/gutenberg-releases.json +155 -0
- package/shared/references/wordpress-core-versions.json +208 -0
- package/shared/references/wp-gutenberg-version-map.json +886 -0
- package/shared/scripts/ai-generate-updates.mjs +458 -0
- package/shared/scripts/scaffold-skill.mjs +62 -0
- package/shared/scripts/skillpack-build.mjs +165 -0
- package/shared/scripts/skillpack-install.mjs +275 -0
- package/shared/scripts/update-upstream-indices.mjs +173 -0
- package/skills/wordpress-router/SKILL.md +51 -0
- package/skills/wordpress-router/references/decision-tree.md +55 -0
- package/skills/wp-abilities-api/SKILL.md +95 -0
- package/skills/wp-abilities-api/references/php-registration.md +67 -0
- package/skills/wp-abilities-api/references/rest-api.md +13 -0
- package/skills/wp-block-development/SKILL.md +174 -0
- package/skills/wp-block-development/references/attributes-and-serialization.md +22 -0
- package/skills/wp-block-development/references/block-json.md +49 -0
- package/skills/wp-block-development/references/creating-new-blocks.md +46 -0
- package/skills/wp-block-development/references/debugging.md +36 -0
- package/skills/wp-block-development/references/deprecations.md +24 -0
- package/skills/wp-block-development/references/dynamic-rendering.md +23 -0
- package/skills/wp-block-development/references/inner-blocks.md +25 -0
- package/skills/wp-block-development/references/registration.md +30 -0
- package/skills/wp-block-development/references/supports-and-wrappers.md +18 -0
- package/skills/wp-block-development/references/tooling-and-testing.md +21 -0
- package/skills/wp-block-development/scripts/list_blocks.mjs +121 -0
- package/skills/wp-block-themes/SKILL.md +116 -0
- package/skills/wp-block-themes/references/creating-new-block-theme.md +37 -0
- package/skills/wp-block-themes/references/debugging.md +24 -0
- package/skills/wp-block-themes/references/patterns.md +18 -0
- package/skills/wp-block-themes/references/style-variations.md +14 -0
- package/skills/wp-block-themes/references/templates-and-parts.md +16 -0
- package/skills/wp-block-themes/references/theme-json.md +59 -0
- package/skills/wp-block-themes/scripts/detect_block_themes.mjs +117 -0
- package/skills/wp-interactivity-api/SKILL.md +179 -0
- package/skills/wp-interactivity-api/references/debugging.md +29 -0
- package/skills/wp-interactivity-api/references/directives-quickref.md +30 -0
- package/skills/wp-interactivity-api/references/server-side-rendering.md +310 -0
- package/skills/wp-performance/SKILL.md +146 -0
- package/skills/wp-performance/references/autoload-options.md +24 -0
- package/skills/wp-performance/references/cron.md +20 -0
- package/skills/wp-performance/references/database.md +20 -0
- package/skills/wp-performance/references/http-api.md +15 -0
- package/skills/wp-performance/references/measurement.md +21 -0
- package/skills/wp-performance/references/object-cache.md +24 -0
- package/skills/wp-performance/references/query-monitor-headless.md +38 -0
- package/skills/wp-performance/references/server-timing.md +22 -0
- package/skills/wp-performance/references/wp-cli-doctor.md +24 -0
- package/skills/wp-performance/references/wp-cli-profile.md +32 -0
- package/skills/wp-performance/scripts/perf_inspect.mjs +128 -0
- package/skills/wp-phpstan/SKILL.md +97 -0
- package/skills/wp-phpstan/references/configuration.md +52 -0
- package/skills/wp-phpstan/references/third-party-classes.md +76 -0
- package/skills/wp-phpstan/references/wordpress-annotations.md +124 -0
- package/skills/wp-phpstan/scripts/phpstan_inspect.mjs +263 -0
- package/skills/wp-playground/SKILL.md +101 -0
- package/skills/wp-playground/references/blueprints.md +36 -0
- package/skills/wp-playground/references/cli-commands.md +39 -0
- package/skills/wp-playground/references/debugging.md +16 -0
- package/skills/wp-plugin-development/SKILL.md +112 -0
- package/skills/wp-plugin-development/references/data-and-cron.md +19 -0
- package/skills/wp-plugin-development/references/debugging.md +19 -0
- package/skills/wp-plugin-development/references/lifecycle.md +33 -0
- package/skills/wp-plugin-development/references/security.md +29 -0
- package/skills/wp-plugin-development/references/settings-api.md +22 -0
- package/skills/wp-plugin-development/references/structure.md +16 -0
- package/skills/wp-plugin-development/scripts/detect_plugins.mjs +122 -0
- package/skills/wp-project-triage/SKILL.md +38 -0
- package/skills/wp-project-triage/references/triage.schema.json +143 -0
- package/skills/wp-project-triage/scripts/detect_wp_project.mjs +592 -0
- package/skills/wp-rest-api/SKILL.md +114 -0
- package/skills/wp-rest-api/references/authentication.md +18 -0
- package/skills/wp-rest-api/references/custom-content-types.md +20 -0
- package/skills/wp-rest-api/references/discovery-and-params.md +20 -0
- package/skills/wp-rest-api/references/responses-and-fields.md +30 -0
- package/skills/wp-rest-api/references/routes-and-endpoints.md +36 -0
- package/skills/wp-rest-api/references/schema.md +22 -0
- package/skills/wp-wpcli-and-ops/SKILL.md +123 -0
- package/skills/wp-wpcli-and-ops/references/automation.md +30 -0
- package/skills/wp-wpcli-and-ops/references/cron-and-cache.md +23 -0
- package/skills/wp-wpcli-and-ops/references/debugging.md +17 -0
- package/skills/wp-wpcli-and-ops/references/multisite.md +22 -0
- package/skills/wp-wpcli-and-ops/references/packages-and-updates.md +22 -0
- package/skills/wp-wpcli-and-ops/references/safety.md +30 -0
- package/skills/wp-wpcli-and-ops/references/search-replace.md +40 -0
- package/skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs +90 -0
- package/skills/wpds/SKILL.md +58 -0
- package/workflows/create-block.md +27 -0
- package/workflows/wp-lint.md +27 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Authentication (summary)
|
|
2
|
+
|
|
3
|
+
## Cookie authentication (in-dashboard / same-site)
|
|
4
|
+
|
|
5
|
+
- Standard for wp-admin and theme/plugin JS.
|
|
6
|
+
- Requires a REST nonce (`wp_rest`) sent as `X-WP-Nonce` header or `_wpnonce` param.
|
|
7
|
+
- If the nonce is missing, the request is treated as unauthenticated even if cookies exist.
|
|
8
|
+
|
|
9
|
+
## Application Passwords (external clients)
|
|
10
|
+
|
|
11
|
+
- Available in WordPress 5.6+.
|
|
12
|
+
- Use HTTPS + Basic Auth with the application password.
|
|
13
|
+
- Recommended over the legacy Basic Auth plugin.
|
|
14
|
+
|
|
15
|
+
## Auth plugins
|
|
16
|
+
|
|
17
|
+
- OAuth 1.0a or JWT plugins are common for external apps.
|
|
18
|
+
- Use only if required; follow plugin docs and security guidance.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Custom Content Types (summary)
|
|
2
|
+
|
|
3
|
+
## Custom post types
|
|
4
|
+
|
|
5
|
+
- Set `show_in_rest => true` in `register_post_type()` to expose in `wp/v2`.
|
|
6
|
+
- Use `rest_base` to change the route slug.
|
|
7
|
+
- Optionally set `rest_controller_class` (must extend `WP_REST_Controller`).
|
|
8
|
+
|
|
9
|
+
## Custom taxonomies
|
|
10
|
+
|
|
11
|
+
- Set `show_in_rest => true` in `register_taxonomy()`.
|
|
12
|
+
- Use `rest_base` and optional `rest_controller_class` (default `WP_REST_Terms_Controller`).
|
|
13
|
+
|
|
14
|
+
## Adding REST support to existing types
|
|
15
|
+
|
|
16
|
+
- Use `register_post_type_args` or `register_taxonomy_args` filters to enable `show_in_rest` for types you do not control.
|
|
17
|
+
|
|
18
|
+
## Discovery links for custom controllers
|
|
19
|
+
|
|
20
|
+
- If you use a custom controller class, use `rest_route_for_post` or `rest_route_for_term` filters to map objects to routes.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Discovery and Global Parameters (summary)
|
|
2
|
+
|
|
3
|
+
## API discovery
|
|
4
|
+
|
|
5
|
+
- REST API root is discovered via the `Link` header: `rel="https://api.w.org/"`.
|
|
6
|
+
- HTML pages also include a `<link rel="https://api.w.org/" href="...">` element.
|
|
7
|
+
- For non-pretty permalinks, use `?rest_route=/`.
|
|
8
|
+
|
|
9
|
+
## Global parameters
|
|
10
|
+
|
|
11
|
+
- `_fields` limits response fields (supports nested meta keys).
|
|
12
|
+
- `_embed` includes linked resources in `_embedded`.
|
|
13
|
+
- `_method` or `X-HTTP-Method-Override` allows POST to simulate PUT/DELETE.
|
|
14
|
+
- `_envelope` puts headers/status in the response body.
|
|
15
|
+
- `_jsonp` enables JSONP for legacy clients.
|
|
16
|
+
|
|
17
|
+
## Pagination
|
|
18
|
+
|
|
19
|
+
- Collections accept `page`, `per_page` (1-100), and `offset`.
|
|
20
|
+
- Pagination headers: `X-WP-Total` and `X-WP-TotalPages`.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Responses and Fields (summary)
|
|
2
|
+
|
|
3
|
+
## Do not remove core fields
|
|
4
|
+
|
|
5
|
+
- Removing or changing core fields breaks clients (including wp-admin).
|
|
6
|
+
- Prefer adding new fields or using `_fields` to limit response size.
|
|
7
|
+
|
|
8
|
+
## register_rest_field
|
|
9
|
+
|
|
10
|
+
- Use for computed or custom fields.
|
|
11
|
+
- Provide `get_callback`, optional `update_callback`, and `schema`.
|
|
12
|
+
- Register on `rest_api_init`.
|
|
13
|
+
|
|
14
|
+
## Raw vs rendered content
|
|
15
|
+
|
|
16
|
+
- For posts, `content.rendered` reflects filters (plugins like ToC inject HTML).
|
|
17
|
+
- Use `?context=edit` (authenticated) to access `content.raw`.
|
|
18
|
+
- Combine with `_fields=content.raw` when you only need the editable body.
|
|
19
|
+
|
|
20
|
+
## register_meta / register_post_meta / register_term_meta
|
|
21
|
+
|
|
22
|
+
- Use when the data is stored as meta.
|
|
23
|
+
- Set `show_in_rest => true` to expose under `.meta`.
|
|
24
|
+
- For `object` or `array` types, provide a JSON schema in `show_in_rest.schema`.
|
|
25
|
+
|
|
26
|
+
## Links and embedding
|
|
27
|
+
|
|
28
|
+
- Add links with `WP_REST_Response::add_link( $rel, $href, $attrs )`.
|
|
29
|
+
- Use `embeddable => true` to allow `_embed`.
|
|
30
|
+
- Use IANA rels or a custom URI relation; CURIEs can be registered via `rest_response_link_curies`.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Routes and Endpoints (summary)
|
|
2
|
+
|
|
3
|
+
## Registering routes
|
|
4
|
+
|
|
5
|
+
- Register routes on the `rest_api_init` hook with `register_rest_route( $namespace, $route, $args )`.
|
|
6
|
+
- A **route** is the URL pattern; an **endpoint** is the method + callback bound to that route.
|
|
7
|
+
- For non-pretty permalinks, the route is accessed via `?rest_route=/namespace/route`.
|
|
8
|
+
|
|
9
|
+
## Namespacing
|
|
10
|
+
|
|
11
|
+
- Always namespace routes (`vendor/v1`).
|
|
12
|
+
- **Do not** use the `wp/*` namespace unless you are targeting core.
|
|
13
|
+
|
|
14
|
+
## Methods
|
|
15
|
+
|
|
16
|
+
- Use `WP_REST_Server::READABLE` (GET), `CREATABLE` (POST), `EDITABLE` (PUT/PATCH), `DELETABLE` (DELETE).
|
|
17
|
+
- Multiple endpoints can share a route, one per method.
|
|
18
|
+
|
|
19
|
+
## permission_callback (required)
|
|
20
|
+
|
|
21
|
+
- Always provide `permission_callback`.
|
|
22
|
+
- Public endpoints should use `__return_true`.
|
|
23
|
+
- For restricted endpoints, use capability checks (`current_user_can`) or object-level authorization.
|
|
24
|
+
- Missing `permission_callback` emits a `_doing_it_wrong` notice in modern WP.
|
|
25
|
+
|
|
26
|
+
## Arguments
|
|
27
|
+
|
|
28
|
+
- Register `args` to validate and sanitize inputs.
|
|
29
|
+
- Use `type`, `required`, `default`, `validate_callback`, `sanitize_callback`.
|
|
30
|
+
- Access params via the `WP_REST_Request` object, not `$_GET`/`$_POST`.
|
|
31
|
+
|
|
32
|
+
## Return values
|
|
33
|
+
|
|
34
|
+
- Return data via `rest_ensure_response()` or a `WP_REST_Response`.
|
|
35
|
+
- Return `WP_Error` with a `status` in `data` for error responses.
|
|
36
|
+
- Do not call `wp_send_json()` in REST callbacks.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Schema and Argument Validation (summary)
|
|
2
|
+
|
|
3
|
+
## JSON Schema in WordPress
|
|
4
|
+
|
|
5
|
+
- REST API uses JSON Schema (draft 4 subset) for resource and argument definitions.
|
|
6
|
+
- Provide schema via `get_item_schema()` on controllers or `schema` callbacks on routes.
|
|
7
|
+
- Schema enables discovery (`OPTIONS`) and validation.
|
|
8
|
+
|
|
9
|
+
## Validation + sanitization
|
|
10
|
+
|
|
11
|
+
- Use `rest_validate_value_from_schema( $value, $schema )` then `rest_sanitize_value_from_schema( $value, $schema )`.
|
|
12
|
+
- If you override `sanitize_callback`, built-in schema validation will not run; use `rest_validate_request_arg` to keep it.
|
|
13
|
+
- `WP_REST_Controller::get_endpoint_args_for_item_schema()` wires validation automatically.
|
|
14
|
+
|
|
15
|
+
## Schema caching
|
|
16
|
+
|
|
17
|
+
- Cache the generated schema on the controller instance (`$this->schema`) to avoid recomputation.
|
|
18
|
+
|
|
19
|
+
## Formats and types
|
|
20
|
+
|
|
21
|
+
- Common formats: `date-time`, `uri`, `email`, `ip`, `uuid`, `hex-color`.
|
|
22
|
+
- For `array` and `object` types, you must define `items` or `properties` schemas.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wp-wpcli-and-ops
|
|
3
|
+
description: "Use when working with WP-CLI (wp) for WordPress operations: safe search-replace, db export/import, plugin/theme/user/content management, cron, cache flushing, multisite, and scripting/automation with wp-cli.yml."
|
|
4
|
+
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Requires WP-CLI in the execution environment."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# WP-CLI and Ops
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
|
|
11
|
+
Use this skill when the task involves WordPress operational work via WP-CLI, including:
|
|
12
|
+
|
|
13
|
+
- `wp search-replace` (URL changes, domain migrations, protocol switch)
|
|
14
|
+
- DB export/import, resets, and inspections (`wp db *`)
|
|
15
|
+
- plugin/theme install/activate/update, language packs
|
|
16
|
+
- cron event listing/running
|
|
17
|
+
- cache/rewrite flushing
|
|
18
|
+
- multisite operations (`wp site *`, `--url`, `--network`)
|
|
19
|
+
- building repeatable scripts (`wp-cli.yml`, shell scripts, CI jobs)
|
|
20
|
+
|
|
21
|
+
## Inputs required
|
|
22
|
+
|
|
23
|
+
- Where WP-CLI will run (local dev, staging, production) and whether it’s safe to run.
|
|
24
|
+
- How to target the correct site root:
|
|
25
|
+
- `--path=<wordpress-root>` and (multisite) `--url=<site-url>`
|
|
26
|
+
- Whether this is multisite and whether commands should run network-wide.
|
|
27
|
+
- Any constraints (no downtime, no DB writes, maintenance window).
|
|
28
|
+
|
|
29
|
+
## Procedure
|
|
30
|
+
|
|
31
|
+
### 0) Guardrails: confirm environment and blast radius
|
|
32
|
+
|
|
33
|
+
WP-CLI commands can be destructive. Before running anything that writes:
|
|
34
|
+
|
|
35
|
+
1. Confirm environment (dev/staging/prod).
|
|
36
|
+
2. Confirm targeting (path/url) so you don’t hit the wrong site.
|
|
37
|
+
3. Make a backup when performing risky operations.
|
|
38
|
+
|
|
39
|
+
Read:
|
|
40
|
+
- `references/safety.md`
|
|
41
|
+
|
|
42
|
+
### 1) Inspect WP-CLI and site targeting (deterministic)
|
|
43
|
+
|
|
44
|
+
Run the inspector:
|
|
45
|
+
|
|
46
|
+
- `node skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs --path=<path> [--url=<url>]`
|
|
47
|
+
|
|
48
|
+
If WP-CLI isn’t available, fall back to installing it via the project’s documented tooling (Composer, container, or system package), or ask for the expected execution environment.
|
|
49
|
+
|
|
50
|
+
### 2) Choose the right workflow
|
|
51
|
+
|
|
52
|
+
#### A) Safe URL/domain migration (`search-replace`)
|
|
53
|
+
|
|
54
|
+
Follow a safe sequence:
|
|
55
|
+
|
|
56
|
+
1. `wp db export` (backup)
|
|
57
|
+
2. `wp search-replace --dry-run` (review impact)
|
|
58
|
+
3. Run the real replace with appropriate flags
|
|
59
|
+
4. Flush caches/rewrite if needed
|
|
60
|
+
|
|
61
|
+
Read:
|
|
62
|
+
- `references/search-replace.md`
|
|
63
|
+
|
|
64
|
+
#### B) Plugin/theme operations
|
|
65
|
+
|
|
66
|
+
Use `wp plugin *` / `wp theme *` and confirm you’re acting on the intended site (and network) first.
|
|
67
|
+
|
|
68
|
+
Read:
|
|
69
|
+
- `references/packages-and-updates.md`
|
|
70
|
+
|
|
71
|
+
#### C) Cron and queues
|
|
72
|
+
|
|
73
|
+
Inspect cron state and run individual events for debugging rather than “run everything blindly”.
|
|
74
|
+
|
|
75
|
+
Read:
|
|
76
|
+
- `references/cron-and-cache.md`
|
|
77
|
+
|
|
78
|
+
#### D) Multisite operations
|
|
79
|
+
|
|
80
|
+
Multisite changes can affect many sites. Always decide whether you’re operating:
|
|
81
|
+
|
|
82
|
+
- on a single site (`--url=`), or
|
|
83
|
+
- network-wide (`--network` / iterating sites)
|
|
84
|
+
|
|
85
|
+
Read:
|
|
86
|
+
- `references/multisite.md`
|
|
87
|
+
|
|
88
|
+
### 3) Automation patterns (scripts + wp-cli.yml)
|
|
89
|
+
|
|
90
|
+
For repeatable ops, prefer:
|
|
91
|
+
|
|
92
|
+
- `wp-cli.yml` for defaults (path/url, PHP memory limits)
|
|
93
|
+
- shell scripts that log commands and stop on error
|
|
94
|
+
- CI jobs that run read-only checks by default
|
|
95
|
+
|
|
96
|
+
Read:
|
|
97
|
+
- `references/automation.md`
|
|
98
|
+
|
|
99
|
+
## Verification
|
|
100
|
+
|
|
101
|
+
- Re-run `wpcli_inspect` after changes that could affect targeting or config.
|
|
102
|
+
- Confirm intended side effects:
|
|
103
|
+
- correct URLs updated
|
|
104
|
+
- plugins/themes in expected state
|
|
105
|
+
- cron/caches flushed where needed
|
|
106
|
+
- If there’s a health check endpoint or smoke test suite, run it after ops changes.
|
|
107
|
+
|
|
108
|
+
## Failure modes / debugging
|
|
109
|
+
|
|
110
|
+
- “Error: This does not seem to be a WordPress installation.”
|
|
111
|
+
- wrong `--path`, wrong container, or missing `wp-config.php`
|
|
112
|
+
- Multisite commands affecting the wrong site
|
|
113
|
+
- missing `--url` or wrong URL
|
|
114
|
+
- Search-replace causes unexpected serialization issues
|
|
115
|
+
- wrong flags or changing serialized data unsafely
|
|
116
|
+
|
|
117
|
+
See:
|
|
118
|
+
- `references/debugging.md`
|
|
119
|
+
|
|
120
|
+
## Escalation
|
|
121
|
+
|
|
122
|
+
- If you cannot confirm environment safety, do not run write operations.
|
|
123
|
+
- If the repo uses containerized tooling (Docker/wp-env) but you can’t access it, ask for the intended command runner or CI job.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Automation with WP-CLI
|
|
2
|
+
|
|
3
|
+
Use this file when turning an ops sequence into a repeatable script or CI job.
|
|
4
|
+
|
|
5
|
+
## `wp-cli.yml`
|
|
6
|
+
|
|
7
|
+
If the repo uses `wp-cli.yml`, use it to standardize:
|
|
8
|
+
|
|
9
|
+
- `path:` (WordPress root)
|
|
10
|
+
- `url:` (default site)
|
|
11
|
+
- PHP settings (memory limits)
|
|
12
|
+
|
|
13
|
+
## Shell scripting
|
|
14
|
+
|
|
15
|
+
Guardrails for scripts:
|
|
16
|
+
|
|
17
|
+
- `set -euo pipefail`
|
|
18
|
+
- print commands before running them
|
|
19
|
+
- make destructive operations require an explicit flag (e.g. `--apply`)
|
|
20
|
+
|
|
21
|
+
## CI jobs
|
|
22
|
+
|
|
23
|
+
Prefer CI jobs that are read-only by default:
|
|
24
|
+
|
|
25
|
+
- `wp core version`
|
|
26
|
+
- `wp plugin list`
|
|
27
|
+
- `wp theme list`
|
|
28
|
+
|
|
29
|
+
Only enable write operations in dedicated deploy/maintenance workflows.
|
|
30
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Cron, caches, and rewrites
|
|
2
|
+
|
|
3
|
+
Use this file when debugging background jobs or “changes not visible”.
|
|
4
|
+
|
|
5
|
+
## Cron
|
|
6
|
+
|
|
7
|
+
- List scheduled events:
|
|
8
|
+
- `wp cron event list`
|
|
9
|
+
- Run a specific event now:
|
|
10
|
+
- `wp cron event run <hook>`
|
|
11
|
+
|
|
12
|
+
## Cache + rewrite
|
|
13
|
+
|
|
14
|
+
- Flush object cache:
|
|
15
|
+
- `wp cache flush`
|
|
16
|
+
- Flush rewrite rules:
|
|
17
|
+
- `wp rewrite flush`
|
|
18
|
+
|
|
19
|
+
## Guardrails
|
|
20
|
+
|
|
21
|
+
- Don’t “run all cron events” on production without understanding impact.
|
|
22
|
+
- Cache flush can cause load spikes; coordinate if needed.
|
|
23
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Debugging WP-CLI
|
|
2
|
+
|
|
3
|
+
## WP not found / wrong WP root
|
|
4
|
+
|
|
5
|
+
- Run `wp --info`.
|
|
6
|
+
- Provide `--path=<wordpress-root>` if WP is not in the current directory.
|
|
7
|
+
- Confirm `wp-config.php` exists in the expected root.
|
|
8
|
+
|
|
9
|
+
## HTTP/URL targeting issues
|
|
10
|
+
|
|
11
|
+
- On multisite, include `--url=<site-url>` for site-specific actions.
|
|
12
|
+
|
|
13
|
+
## Permission/file ownership issues
|
|
14
|
+
|
|
15
|
+
- If running in containers, ensure you’re using the same user/volume mapping as the app.
|
|
16
|
+
- Avoid `--allow-root` unless you understand the environment and have no alternative.
|
|
17
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Multisite targeting
|
|
2
|
+
|
|
3
|
+
Use this file any time you might be operating on multisite.
|
|
4
|
+
|
|
5
|
+
## Key flags
|
|
6
|
+
|
|
7
|
+
- `--url=<site-url>` targets a specific site/blog context.
|
|
8
|
+
- `--network` applies to the network where supported.
|
|
9
|
+
|
|
10
|
+
## Common commands
|
|
11
|
+
|
|
12
|
+
- List sites:
|
|
13
|
+
- `wp site list`
|
|
14
|
+
- Get site options for a specific site:
|
|
15
|
+
- `wp option get siteurl --url=<site-url>`
|
|
16
|
+
|
|
17
|
+
## Guardrails
|
|
18
|
+
|
|
19
|
+
- Always include `--url` when you mean “one site” in a multisite install.
|
|
20
|
+
- If you need to run something across sites, prefer scripting:
|
|
21
|
+
- list sites → iterate → run a safe per-site command.
|
|
22
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Plugin/theme operations
|
|
2
|
+
|
|
3
|
+
Use this file for installs, activation, updates, and listing state.
|
|
4
|
+
|
|
5
|
+
## Common commands
|
|
6
|
+
|
|
7
|
+
- Plugins:
|
|
8
|
+
- `wp plugin list`
|
|
9
|
+
- `wp plugin status <slug>`
|
|
10
|
+
- `wp plugin activate <slug>`
|
|
11
|
+
- `wp plugin deactivate <slug>`
|
|
12
|
+
- `wp plugin update --all`
|
|
13
|
+
- Themes:
|
|
14
|
+
- `wp theme list`
|
|
15
|
+
- `wp theme activate <slug>`
|
|
16
|
+
- `wp theme update --all`
|
|
17
|
+
|
|
18
|
+
## Guardrails
|
|
19
|
+
|
|
20
|
+
- On production, avoid `update --all` without a maintenance window.
|
|
21
|
+
- On multisite, plugin activation may be per-site or network-wide; confirm intent.
|
|
22
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Safety rules (WP-CLI)
|
|
2
|
+
|
|
3
|
+
Use this file before running any write operations.
|
|
4
|
+
|
|
5
|
+
## Golden rules
|
|
6
|
+
|
|
7
|
+
- Assume production is **unsafe** unless explicitly confirmed.
|
|
8
|
+
- Always confirm targeting:
|
|
9
|
+
- `--path` (WordPress root)
|
|
10
|
+
- `--url` (multisite / specific site targeting)
|
|
11
|
+
- Prefer a backup (`wp db export`) before risky operations.
|
|
12
|
+
- Prefer `--dry-run` where available (especially `search-replace`).
|
|
13
|
+
|
|
14
|
+
## High-risk commands (require explicit confirmation)
|
|
15
|
+
|
|
16
|
+
- `wp db reset`
|
|
17
|
+
- `wp db import` (overwrites data)
|
|
18
|
+
- `wp search-replace` (can affect serialized data and URLs)
|
|
19
|
+
- bulk deletes (`wp post delete --force --all`, `wp user delete --reassign`, etc.)
|
|
20
|
+
- plugin/theme mass updates on production
|
|
21
|
+
|
|
22
|
+
## Logging
|
|
23
|
+
|
|
24
|
+
For ops scripts, log:
|
|
25
|
+
|
|
26
|
+
- date/time
|
|
27
|
+
- environment (dev/staging/prod)
|
|
28
|
+
- exact WP-CLI commands
|
|
29
|
+
- exit codes
|
|
30
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Safe `wp search-replace`
|
|
2
|
+
|
|
3
|
+
Use this file when migrating domains, switching http→https, or changing paths.
|
|
4
|
+
|
|
5
|
+
## Recommended workflow
|
|
6
|
+
|
|
7
|
+
1. Backup:
|
|
8
|
+
- `wp db export`
|
|
9
|
+
2. Dry run:
|
|
10
|
+
- `wp search-replace OLD NEW --dry-run`
|
|
11
|
+
3. Run for real (carefully choose scope):
|
|
12
|
+
- consider `--all-tables-with-prefix` if you need to include non-core tables with the WP prefix
|
|
13
|
+
4. Flush:
|
|
14
|
+
- `wp cache flush`
|
|
15
|
+
- `wp rewrite flush`
|
|
16
|
+
|
|
17
|
+
## Multisite notes
|
|
18
|
+
|
|
19
|
+
For multisite, decide whether you’re replacing:
|
|
20
|
+
|
|
21
|
+
- a single site (`--url=...`), or
|
|
22
|
+
- across the network (`--network` or iterating `wp site list`).
|
|
23
|
+
|
|
24
|
+
Read:
|
|
25
|
+
- `references/multisite.md`
|
|
26
|
+
|
|
27
|
+
## Common flags
|
|
28
|
+
|
|
29
|
+
- `--dry-run`
|
|
30
|
+
- `--precise` (slower but can be safer in complex cases)
|
|
31
|
+
- `--skip-columns=...` (avoid touching large/binary columns)
|
|
32
|
+
- `--report-changed-only`
|
|
33
|
+
|
|
34
|
+
## Serialization caution
|
|
35
|
+
|
|
36
|
+
WP-CLI search-replace is designed to handle PHP serialized data, but you must still:
|
|
37
|
+
|
|
38
|
+
- avoid replacing within binary/blob columns
|
|
39
|
+
- validate results with application smoke tests
|
|
40
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
const TOOL_VERSION = "0.1.0";
|
|
4
|
+
|
|
5
|
+
function parseArgs(argv) {
|
|
6
|
+
const args = { path: null, url: null, allowRoot: false };
|
|
7
|
+
for (const a of argv) {
|
|
8
|
+
if (a === "--allow-root") args.allowRoot = true;
|
|
9
|
+
if (a.startsWith("--path=")) args.path = a.slice("--path=".length);
|
|
10
|
+
if (a.startsWith("--url=")) args.url = a.slice("--url=".length);
|
|
11
|
+
}
|
|
12
|
+
return args;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function runWp(cmdArgs, { pathArg, urlArg, allowRoot }) {
|
|
16
|
+
const args = [];
|
|
17
|
+
if (allowRoot) args.push("--allow-root");
|
|
18
|
+
if (pathArg) args.push(`--path=${pathArg}`);
|
|
19
|
+
if (urlArg) args.push(`--url=${urlArg}`);
|
|
20
|
+
args.push(...cmdArgs);
|
|
21
|
+
|
|
22
|
+
const out = spawnSync("wp", args, { encoding: "utf8" });
|
|
23
|
+
return {
|
|
24
|
+
ok: out.status === 0,
|
|
25
|
+
status: out.status,
|
|
26
|
+
error: out.error ? { message: out.error.message, code: out.error.code } : null,
|
|
27
|
+
stdout: (out.stdout || "").trim(),
|
|
28
|
+
stderr: (out.stderr || "").trim(),
|
|
29
|
+
args,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function main() {
|
|
34
|
+
const opts = parseArgs(process.argv.slice(2));
|
|
35
|
+
|
|
36
|
+
const info = runWp(["--info"], { pathArg: null, urlArg: null, allowRoot: opts.allowRoot });
|
|
37
|
+
const report = {
|
|
38
|
+
tool: { name: "wpcli_inspect", version: TOOL_VERSION },
|
|
39
|
+
wpCli: {
|
|
40
|
+
available: info.ok,
|
|
41
|
+
info,
|
|
42
|
+
},
|
|
43
|
+
wordpress: {
|
|
44
|
+
path: opts.path,
|
|
45
|
+
url: opts.url,
|
|
46
|
+
isInstalled: null,
|
|
47
|
+
coreVersion: null,
|
|
48
|
+
isMultisite: null,
|
|
49
|
+
siteurl: null,
|
|
50
|
+
home: null,
|
|
51
|
+
},
|
|
52
|
+
notes: [],
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
if (!info.ok) {
|
|
56
|
+
report.notes.push("WP-CLI not available on PATH. Install WP-CLI or run inside the intended container/environment.");
|
|
57
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const isInstalled = runWp(["core", "is-installed"], { pathArg: opts.path, urlArg: opts.url, allowRoot: opts.allowRoot });
|
|
62
|
+
report.wordpress.isInstalled = isInstalled.ok;
|
|
63
|
+
|
|
64
|
+
if (!isInstalled.ok) {
|
|
65
|
+
report.notes.push("WordPress not detected at the given path/url. Check --path/--url (multisite) and that wp-config.php is present.");
|
|
66
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const coreVersion = runWp(["core", "version"], { pathArg: opts.path, urlArg: opts.url, allowRoot: opts.allowRoot });
|
|
71
|
+
report.wordpress.coreVersion = coreVersion.ok ? coreVersion.stdout : null;
|
|
72
|
+
|
|
73
|
+
const isMultisite = runWp(["core", "is-installed", "--network"], {
|
|
74
|
+
pathArg: opts.path,
|
|
75
|
+
urlArg: opts.url,
|
|
76
|
+
allowRoot: opts.allowRoot,
|
|
77
|
+
});
|
|
78
|
+
// If network check passes, we can assume multisite. If it fails, it might still be multisite depending on context.
|
|
79
|
+
report.wordpress.isMultisite = isMultisite.ok;
|
|
80
|
+
|
|
81
|
+
const siteurl = runWp(["option", "get", "siteurl"], { pathArg: opts.path, urlArg: opts.url, allowRoot: opts.allowRoot });
|
|
82
|
+
report.wordpress.siteurl = siteurl.ok ? siteurl.stdout : null;
|
|
83
|
+
|
|
84
|
+
const home = runWp(["option", "get", "home"], { pathArg: opts.path, urlArg: opts.url, allowRoot: opts.allowRoot });
|
|
85
|
+
report.wordpress.home = home.ok ? home.stdout : null;
|
|
86
|
+
|
|
87
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
main();
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wpds
|
|
3
|
+
description: "Use when building UIs leveraging the WordPress Design System (WPDS) and its components, tokens, patterns, etc."
|
|
4
|
+
compatibility: "Requires WPDS MCP server configured and running. Targets WordPress 6.9+ (PHP 7.2.24+)."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# WordPress Design System (WPDS)
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
This skill works best with the **WPDS MCP server** installed. The MCP provides access to WordPress Design System documentation and resources, such as components and DS token lists.
|
|
12
|
+
|
|
13
|
+
The following terms should be treated as synonyms:
|
|
14
|
+
- "WordPress" and "WP";
|
|
15
|
+
- "Design System" and "DS";
|
|
16
|
+
- "WordPress Design System" and "WPDS".
|
|
17
|
+
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
Use this skill when the user mentions:
|
|
21
|
+
|
|
22
|
+
- building and/or reviewing any UI in a WordPress-related context (for example, Gutenberg, WooCommerce, WordPress.com, Jetpack, etc etc);
|
|
23
|
+
- WordPress Design System, WPDS, Design System;
|
|
24
|
+
- UI components, Design tokens, color primitives, spacing scales, typography variables and presets;
|
|
25
|
+
- Specific component packages such as @wordpress/components or @wordpress/ui;
|
|
26
|
+
|
|
27
|
+
## Rules
|
|
28
|
+
|
|
29
|
+
### Use the WPDS MCP server to access WPDS-related documentation
|
|
30
|
+
|
|
31
|
+
- Use the WPDS MCP server to retrieve the canonical, authoritative documentation:
|
|
32
|
+
- reference site (`wpds://pages`)
|
|
33
|
+
- list of available components (`wpds://components`) and specific component information (`wpds://components/:name`)
|
|
34
|
+
- list of available tokens (`wpds://design-tokens`)
|
|
35
|
+
- DO NOT search the web for canonical documentation about the WordPress Design System. If asked by the user, push back and ask for confirmation, warning them that the MCP server is the best place to provide information
|
|
36
|
+
|
|
37
|
+
### Required documentation
|
|
38
|
+
|
|
39
|
+
Before working on any WPDS-related tasks, make sure you read relevant documentation on the reference site. This documentation should take the absolute precedence when evaluating the best course of action for any given tasks.
|
|
40
|
+
|
|
41
|
+
### Boundaries
|
|
42
|
+
|
|
43
|
+
- Skip non-UI related aspects of an answer (for example, fetching data from stores, or localizing strings of text).
|
|
44
|
+
- Focus on building UI that adheres as much as possible to the WPDS best practices, uses the most fitting WPDS components/tokens/patterns.
|
|
45
|
+
|
|
46
|
+
### Tech stack
|
|
47
|
+
|
|
48
|
+
- Unless you are told otherwise (or gathered specific information from the local context of the request), assume the following tech stack: TypeScript, React, CSS.
|
|
49
|
+
|
|
50
|
+
### Validation
|
|
51
|
+
|
|
52
|
+
- If the local context in which a task is running provide lint scripts, use them to validate the proposed code output when possible.
|
|
53
|
+
|
|
54
|
+
## Output
|
|
55
|
+
|
|
56
|
+
- As a recap at the end of your response, provide a clear and concise explanation of what the solution does, and add context to why each decision was made.
|
|
57
|
+
- Be explicit about the boundaries, ie. what was explicitly left out of the task because not relevant (eg non-ui related).
|
|
58
|
+
- Provide working code snippets
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Scaffold a new WordPress Gutenberg block using @wordpress/create-block.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Create WordPress Block Workflow
|
|
6
|
+
|
|
7
|
+
This workflow guides you through the process of scaffolding a high-quality, modern Gutenberg block.
|
|
8
|
+
|
|
9
|
+
1. **Prerequisites**
|
|
10
|
+
- Ensure Node.js and npm are installed.
|
|
11
|
+
- Verify if the project already uses `@wordpress/scripts`.
|
|
12
|
+
|
|
13
|
+
2. **Scaffold the Block**
|
|
14
|
+
// turbo
|
|
15
|
+
- Run `npx @wordpress/create-block@latest` with the desired name and namespace.
|
|
16
|
+
- Use the `--interactive` flag if custom interactivity is needed.
|
|
17
|
+
|
|
18
|
+
3. **Configure block.json**
|
|
19
|
+
- Update `apiVersion` to `3`.
|
|
20
|
+
- Set up `attributes`, `supports`, and `category`.
|
|
21
|
+
|
|
22
|
+
4. **Initialize Build**
|
|
23
|
+
// turbo
|
|
24
|
+
- Run `npm run start` to begin the development build.
|
|
25
|
+
|
|
26
|
+
5. **Verify Registration**
|
|
27
|
+
- Check if the block is registered correctly in PHP using `register_block_type_from_metadata`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run WordPress-specific linting using @wordpress/scripts and PHPStan.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# WordPress Lint Workflow
|
|
6
|
+
|
|
7
|
+
This workflow ensures your code follows WordPress Coding Standards (WPCS) and passes static analysis.
|
|
8
|
+
|
|
9
|
+
1. **Check for Node dependencies**
|
|
10
|
+
- Check if `node_modules` and `@wordpress/scripts` are present.
|
|
11
|
+
- If not, advise running `npm install`.
|
|
12
|
+
|
|
13
|
+
2. **Run JS/Block Linting**
|
|
14
|
+
// turbo
|
|
15
|
+
- Run `npm run lint:js` or `npx wp-scripts lint-js`.
|
|
16
|
+
|
|
17
|
+
3. **Run CSS Linting**
|
|
18
|
+
// turbo
|
|
19
|
+
- Run `npm run lint:css` or `npx wp-scripts lint-style`.
|
|
20
|
+
|
|
21
|
+
4. **Run PHP Static Analysis**
|
|
22
|
+
// turbo
|
|
23
|
+
- Use `wp-phpstan` skill if configured.
|
|
24
|
+
- Run `vendor/bin/phpstan analyze`.
|
|
25
|
+
|
|
26
|
+
5. **Report Results**
|
|
27
|
+
- Summarize findings and provide fix recommendations.
|