Support alternative alias syntax for cross-platform compatibility#6155
Merged
swissspidy merged 34 commits intomainfrom Mar 12, 2026
Merged
Support alternative alias syntax for cross-platform compatibility#6155swissspidy merged 34 commits intomainfrom
swissspidy merged 34 commits intomainfrom
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…s handling 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] Add support for alternative alias syntax in wp-cli
Support alternative alias syntax for cross-platform compatibility
Nov 15, 2025
swissspidy
reviewed
Nov 15, 2025
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Three improvements based on code review: 1. Fixed validate_alias_type to properly detect group aliases - checks for numeric keys instead of @-prefixed values since groups are now stored as ['foo', 'bar'] without @ prefix 2. Fixed indentation inconsistency in build_aliases elseif block 3. Changed process_aliases to write aliases using the new 'aliases:' format instead of @foo: format for better cross-platform compatibility and consistency Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
swissspidy
reviewed
Feb 20, 2026
- Runner.php: Extend SSH command runtime alias condition to also match --alias=foo syntax (parity with @foo) - CLI_Alias_Command.php: Expand the non-alias config key whitelist to include all standard WP-CLI global parameters (exec, disabled_commands, apache_modules, color, debug, prompt, quiet, allow-root, skip-plugins, skip-themes, skip-packages, context, alias) to prevent config arrays from being incorrectly moved to the aliases: section - Runner.php: Remove redundant duplicate block in run_alias_group that was logging without @ prefix and using verbose array_map before the correct block Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Configurator::add_alias()- handles both@foo:andaliases: { foo: }formatsConfigurator::merge_yml()- processesaliases:keyConfigurator::get_aliases()- normalizes runtime aliases (removes@prefix)CLI_Alias_Command::process_aliases()- writes aliases inaliases:format; whitelist of non-alias config keys is complete (all WP-CLI global params)--alias=<name>toconfig-spec.phpRunner::init_config()- detects@foobefore arg parsing; then checks--alias=fooRunner::run_ssh_command()- condition now handles both@aliasand--alias=foowhen settingWP_CLI_RUNTIME_ALIASRunner::run_alias_group()- removed redundant duplicate logging/arg block; only correct@alias-prefixed log remainsRunner::run_ssh_command()filters--aliasand@aliasfrom forwarded args@prefixfind_alias_key()helper for both YAML formatsvalidate_alias_type()detects groups via numeric keys (not@prefix)build_aliases()preserves existing fields on updateOriginal prompt
This section details on the original issue you should resolve
<issue_title>Support alternative alias syntax for better cross-platform compat</issue_title>
<issue_description>The
wp-clicommand configuration has some mismatches with Windows Powershell.e.g. the
ALIAS_REGEXconstant used to configure remote instances because it uses the@symbol as a prefix.@is used (like the$character as a variable prefix) to expand the variable (converts a string variable in an array).wp-cli/php/WP_CLI/Configurator.php
Line 47 in b179c7a
Would that be possible to allow overriding the constant with some filter?
Alternative question, why are we using
@prodstructure to define the aliases in thewp-cli.ymlinstead of an array of values likedisabled_commandsorrequire?</issue_description><agent_instructions>Add a new aliases configuration entry in the
wp-cli.ymlfileAllow to use
--alias=fooinstead of@footo use an aliasKeep the classic arg notation working
Works properly with the local and global configs merged together even if both styles are used
Here's a previous attempt from a few years ago to give you some extra context: