| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
`user update`, `post create`, `post update`, `comment create` and `comment update` accept `--<field>=<value>`, and their documented field lists have drifted from what core actually accepts. `comment update` documented no fields at all. Fill the lists in from the wp_insert_user(), wp_insert_post() and wp_update_comment() docblocks in core: - user update: syntax_highlighting, comment_shortcuts, admin_color, use_ssl, user_activation_key, spam, show_admin_bar_front, locale, meta_input - post create: page_template, import_id - post update: page_template - comment create / comment update: the full column set, including the mixed-case comment_author_IP and comment_post_ID Two related changes: - `user application-password update` advertised `--<field>=<value>` while documenting that only `name` is supported. Core's WP_Application_Passwords::update_application_password() only ever reads `$update['name']`, so declare that parameter and drop the catch-all. The command is then validated without depending on anything else. - `--meta_input` and `--comment_meta` take arrays, so run them through Utils\parse_shell_arrays() the way Post_Command::update() already does. Without it a JSON value reaches core as a string. The new parameters have no effect on validation on their own, since the catch-all still suppresses it. They are what gives typo detection something accurate to match against. Refs wp-cli/wp-cli#5286 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014SSZzqMJRDTiLiDxQEPYcL
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: fd53f032-0cd5-47d6-9236-6546d10cd7ae 📥 CommitsReviewing files that changed from the base of the PR and between 41a409d and 54c2ae5. 📒 Files selected for processing (4)
Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review. 📝 Walkthrough WalkthroughThe CLI documentation now lists additional comment, post, user, and application-password options. Comment and user update commands parse shell-array metadata before applying WordPress slashing and persistence. ChangesCLI command updates
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to 54c2a This PR documents accepted command fields and corrects array parsing and application-password argument handling without introducing an identified merge-blocking risk; it is merge-ready after normal checks and review. Possibly related PRs
Suggested labels: command:ability Suggested reviewers: brianhenryie 🚥 Pre-merge checks | ✅ 5 ✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Sorry, something went wrong.
PHPStan reported two errors on the calls added in the previous commit: Parameter #1 $assoc_args of function WP_CLI\Utils\parse_shell_arrays expects array<string, string>, array<string, mixed> given. Utils\parse_shell_arrays() is annotated for string values throughout, while Comment_Command's methods correctly declare their arguments as array<string, mixed> - a flag arrives as true, not as a string. Rather than weaken that annotation, hand the function only the one key it needs to look at, and only when it holds a string. That is not a workaround for the type checker: is_json() rejects anything that is not a string, so a non-string value was never going to be parsed either way. Post_Command makes the same call without complaint only because its $assoc_args parameters carry no type at all, and missingType.parameter is in the ignore list. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014SSZzqMJRDTiLiDxQEPYcL
wp-cli/wp-cli#6393 corrected parse_shell_arrays()'s $assoc_args parameter to array<string, mixed>, which is what it always accepted. The local wrapper existed only to work around the previous annotation, so revert to the plain call and let all four call sites in this repo look the same again. This does not need to wait for a wp-cli release: composer.json sets minimum-stability to dev and requires ^3.0, which resolves to dev-main. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014SSZzqMJRDTiLiDxQEPYcL
| Back | FazBrowse Home | New Git URL |
Opened to make the documentation side of wp-cli/wp-cli#5286 concrete. Pairs with wp-cli/wp-cli#6392, which adds the typo detection itself — but this PR stands on its own and is useful without it.
Why this first
Every approach discussed on #5286 needs the same foundation: an accurate list of what each command actually accepts. Typo detection matches an unknown argument against the documented ones, so an incomplete docblock means either missed typos or false positives. comment update documented no fields at all.
On its own this PR does not change validation. The catch-all still suppresses unknown-parameter checking, so the added parameters only improve wp help output today. They are what gives the matcher something accurate to work with.
Where the lists come from
The wp_insert_user(), wp_insert_post() and wp_update_comment() docblocks in core trunk, rather than the 2019 list on the issue — that one predates user_activation_key / spam (5.3) and meta_input (5.9).
Two changes that are not documentation
Flagged separately because they are easy to drop if you'd rather keep this PR pure.
user application-password update advertised --<field>=<value> while its own text said only name was supported. Core's WP_Application_Passwords::update_application_password() only ever reads $update['name'], so extra keys were silently ignored. Replaced the catch-all with [--name=<name>]. That command is now validated immediately, without depending on the framework PR.
--meta_input and --comment_meta take arrays, so they go through Utils\parse_shell_arrays() the way Post_Command::update() already does. Without it a JSON value reaches core as a string. Documenting them without this would have meant documenting parameters that don't work.
The second one originally tripped PHPStan, because parse_shell_arrays() was annotated array<string, string> while Comment_Command correctly declares array<string, mixed>. That turned out to be an upstream annotation bug and is fixed in wp-cli/wp-cli#6393, so all four call sites in this repo are now the same plain one-liner. No release is needed for that — composer.json sets minimum-stability: dev and requires ^3.0, which resolves to dev-main.
Verification
comment_author_IP and comment_post_ID are mixed-case, so they depend on #6388. Against the parser before that fix they register truncated:
Against current main all seven commands parse cleanly, with no truncated names and no unknown tokens:
Two things I noticed but did not change
Both are pre-existing and orthogonal, and both now have tests and fixes in #637.
🤖 Generated with Claude Code
https://claude.ai/code/session_014SSZzqMJRDTiLiDxQEPYcL
Summary by CodeRabbit
Documentation
Bug Fixes