Skip to content

Commit 8d998f4

Browse files
committed
feat: add researched advanced WP-CLI workflows
1 parent b45bdf7 commit 8d998f4

10 files changed

Lines changed: 568 additions & 58 deletions

File tree

‎README.md‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,25 @@ hooks, database operations, and security patterns.
260260
261261
### WP-CLI workflows
262262
263-
`wp-cli-v1` adds 24 operational tasks across content, taxonomy and metadata,
264-
users and capabilities, options and transients, reporting, and maintenance.
263+
`wp-cli-v1` adds 32 operational tasks across content, taxonomy and metadata,
264+
users and capabilities, options and transients, reporting, maintenance, and migration.
265265
Tasks combine selection, changes, and preservation: examples include retiring
266266
an author while reassigning content, consolidating categories, repairing a
267267
plugin that crashes bootstrap, producing scoped JSON/CSV reports, and provisioning
268-
content without duplicates when the script runs again.
268+
content without duplicates when the script runs again. Advanced tasks also cover
269+
serialized URL migrations, menu hierarchy repair, widget relocation, autoload
270+
management, metadata deduplication, incident credential revocation, and CSV onboarding.
271+
272+
These scenarios come from the official command documentation, installed WP-CLI
273+
implementations, and upstream reports. For example, [search-replace issue #137](https://github.com/wp-cli/search-replace-command/issues/137)
274+
documents that serialized array keys are not replaced;
275+
[table resolution](https://github.com/wp-cli/wp-cli/blob/v2.12.0/php/utils-wp.php)
276+
restricts explicitly named tables to the selected scope;
277+
[widget move](https://developer.wordpress.org/cli/commands/widget/move/)
278+
has position semantics that matter when merging widget areas; and [user import-csv](https://developer.wordpress.org/cli/commands/user/import-csv/)
279+
can update existing users unless explicitly told to skip them. Each advanced test records
280+
its research basis and source links in metadata. Prompts describe the desired
281+
WordPress outcome, and equivalent native command workflows are accepted.
269282
270283
```bash
271284
wp-bench run --config wp-bench.example.yaml --suite wp-cli-v1 --execution-concurrency 4
@@ -281,6 +294,8 @@ quoting, pipelines, loops, command substitution, heredocs, and redirection.
281294
not enabled automatically. Each `wp` command boots WordPress separately.
282295
These tasks require native WP-CLI operations and exclude PHP evaluation,
283296
PHP preloading, direct SQL, and edits to WordPress implementation files.
297+
Read-only `wp db prefix` and `wp db tables` discovery is permitted;
298+
these commands do not execute candidate SQL.
284299
Network downloads, MySQL-only database operations, and multisite are outside
285300
this initial SQLite suite.
286301

‎datasets/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ datasets/
1313
│ │ ├── rest-api.json
1414
│ │ └── ...
1515
│ └── wp-cli-v1/
16-
│ └── execution/ # 24 WP-CLI workflows, six categories
16+
│ └── execution/ # 32 WP-CLI workflows, seven categories
1717
├── data/ # Generated Parquet for HF (gitignored)
1818
│ └── test.parquet
1919
├── export_dataset.py # Converts suites → Parquet

‎datasets/suites/wp-cli-v1/execution/cli-content.json‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"static_checks": {
2626
"forbidden_patterns": [
2727
{
28-
"pattern": "/(?:\\bwp\\s+(?:--[^\\s]+\\s+)*(?:eval(?:-file)?|db|shell)\\b|--(?:exec|require)(?:=|\\s)|(?:^|[\\s;&|])(?:php|sqlite3|mysql)\\s)/m",
29-
"description": "Use native WP-CLI operations rather than PHP evaluation or direct database commands",
28+
"pattern": "/(?:\\bwp\\s+(?:--[^\\s]+\\s+)*(?:eval(?:-file)?|db(?!\\s+(?:--[^\\s]+\\s+)*(?:prefix|tables)\\b)|shell)\\b|--(?:exec|require)(?:=|\\s)|(?:^|[\\s;&|])(?:php|sqlite3|mysql)\\s)/m",
29+
"description": "Use native WordPress operations; read-only table/prefix discovery is allowed, but PHP evaluation and direct SQL are forbidden",
3030
"severity": "error"
3131
}
3232
]
@@ -82,8 +82,8 @@
8282
"static_checks": {
8383
"forbidden_patterns": [
8484
{
85-
"pattern": "/(?:\\bwp\\s+(?:--[^\\s]+\\s+)*(?:eval(?:-file)?|db|shell)\\b|--(?:exec|require)(?:=|\\s)|(?:^|[\\s;&|])(?:php|sqlite3|mysql)\\s)/m",
86-
"description": "Use native WP-CLI operations rather than PHP evaluation or direct database commands",
85+
"pattern": "/(?:\\bwp\\s+(?:--[^\\s]+\\s+)*(?:eval(?:-file)?|db(?!\\s+(?:--[^\\s]+\\s+)*(?:prefix|tables)\\b)|shell)\\b|--(?:exec|require)(?:=|\\s)|(?:^|[\\s;&|])(?:php|sqlite3|mysql)\\s)/m",
86+
"description": "Use native WordPress operations; read-only table/prefix discovery is allowed, but PHP evaluation and direct SQL are forbidden",
8787
"severity": "error"
8888
}
8989
]
@@ -140,8 +140,8 @@
140140
"static_checks": {
141141
"forbidden_patterns": [
142142
{
143-
"pattern": "/(?:\\bwp\\s+(?:--[^\\s]+\\s+)*(?:eval(?:-file)?|db|shell)\\b|--(?:exec|require)(?:=|\\s)|(?:^|[\\s;&|])(?:php|sqlite3|mysql)\\s)/m",
144-
"description": "Use native WP-CLI operations rather than PHP evaluation or direct database commands",
143+
"pattern": "/(?:\\bwp\\s+(?:--[^\\s]+\\s+)*(?:eval(?:-file)?|db(?!\\s+(?:--[^\\s]+\\s+)*(?:prefix|tables)\\b)|shell)\\b|--(?:exec|require)(?:=|\\s)|(?:^|[\\s;&|])(?:php|sqlite3|mysql)\\s)/m",
144+
"description": "Use native WordPress operations; read-only table/prefix discovery is allowed, but PHP evaluation and direct SQL are forbidden",
145145
"severity": "error"
146146
}
147147
]
@@ -197,8 +197,8 @@
197197
"static_checks": {
198198
"forbidden_patterns": [
199199
{
200-
"pattern": "/(?:\\bwp\\s+(?:--[^\\s]+\\s+)*(?:eval(?:-file)?|db|shell)\\b|--(?:exec|require)(?:=|\\s)|(?:^|[\\s;&|])(?:php|sqlite3|mysql)\\s)/m",
201-
"description": "Use native WP-CLI operations rather than PHP evaluation or direct database commands",
200+
"pattern": "/(?:\\bwp\\s+(?:--[^\\s]+\\s+)*(?:eval(?:-file)?|db(?!\\s+(?:--[^\\s]+\\s+)*(?:prefix|tables)\\b)|shell)\\b|--(?:exec|require)(?:=|\\s)|(?:^|[\\s;&|])(?:php|sqlite3|mysql)\\s)/m",
201+
"description": "Use native WordPress operations; read-only table/prefix discovery is allowed, but PHP evaluation and direct SQL are forbidden",
202202
"severity": "error"
203203
}
204204
]

0 commit comments

Comments
 (0)