Skip to content

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
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 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
Copilot finished work on behalf of swissspidy November 2, 2025 15:29
When I run `wp config update WP_DEBUG true --raw`
Then STDOUT should be:
"""
Success: Added the constant 'WP_DEBUG' to the 'wp-config.php' file with the raw value 'true'.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Since WP_DEBUG is already set by default, need to change this assertion to Success: Updated the constant 'WP_DEBUG' in the 'wp-config.php' file with the raw value 'true'.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed assertion to expect "Updated" instead of "Added" in commit dd07f44.

Copilot AI requested a review from swissspidy November 2, 2025 16:05
Copilot finished work on behalf of swissspidy November 2, 2025 16:05
@codecov
Copy link

codecov bot commented Nov 2, 2025

Codecov Report

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

Files with missing lines Patch % Lines
src/Config_Command.php 97.22% 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Abstract config set --add to config add

2 participants