Skip to content

Add wp config add and wp config update commands#206

Open
Copilot wants to merge 10 commits intomainfrom
copilot/add-config-add-and-update-commands
Open

Add wp config add and wp config update commands#206
Copilot wants to merge 10 commits intomainfrom
copilot/add-config-add-and-update-commands

Conversation

Copy link

Copilot AI commented Nov 2, 2025

  • Add new config add command that adds a constant/variable (fails if it already exists)
  • Add new config update command that updates or adds a constant/variable (upsert behavior)
  • Keep config set command for backward compatibility
  • Add tests for config add command
  • Add tests for config update command
  • Update composer.json to register new commands
  • Update class docblock with examples for new commands
  • Address code review feedback
  • Security scan with CodeQL (no issues found)
  • Verify implementation
  • Address PR feedback:
    • Changed WP_DEBUG to WP_CUSTOM_CONSTANT in config-add test (WP_DEBUG exists by default)
    • Fixed assertion in config-update test to expect "Updated" instead of "Added"
    • Aligned equal signs in Config_Command.php
  • Refactor for DRY principle and fix PHPDoc:
    • Extracted duplicate option parsing logic into parse_config_transformer_options() helper method
    • Fixed PHPDoc type hint from array<string, string> to array<string, string|bool> to accurately reflect boolean flags
    • Updated set(), add(), and update() methods to use the new helper
Original prompt

This section details on the original issue you should resolve

<issue_title>Abstract config set --add to config add</issue_title>
<issue_description>config set --add is a deviation from our standard syntax. Typically, set and add are two separate operations (e.g. option set vs. option add, and cache set vs. cache add).

It'd be better to abstract config set --add to config add.

We may also consider a config update, which would add the constant if it didn't exist, or update it if it did.</issue_description>

<agent_instructions>Add new wp config add & wp config update commands for this logic.

config set should be kept for backward compatibility.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@danielbachhuber @wp-cli/committers Does this seem reasonable to you? @schlessera Hehe, I think I started out with `wp config add` & `wp config update`, but then later changed it.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits November 2, 2025 15:21
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Abstract config set --add to config add and add update command Add wp config add and wp config update commands Nov 2, 2025
Copilot AI requested a review from swissspidy November 2, 2025 15:29
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Nov 2, 2025

Codecov Report

❌ Patch coverage is 96.92308% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Config_Command.php 96.92% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review November 2, 2025 16:55
@swissspidy swissspidy requested a review from a team as a code owner November 2, 2025 16:55
@swissspidy swissspidy requested a review from Copilot January 20, 2026 12:40
@swissspidy

This comment was marked as resolved.

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@swissspidy swissspidy added this to the 2.4.1 milestone Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Abstract config set --add to config add

2 participants