Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 2, 2025

Add --no-interaction flag to package commands to prevent interactive prompts

  • Add --no-interaction flag to wp package install command
  • Add --no-interaction flag to wp package update command
  • Add --no-interaction flag to wp package uninstall command
  • Set GIT_TERMINAL_PROMPT=0 environment variable when flag is used
  • Set GIT_SSH_COMMAND=ssh -o BatchMode=yes when flag is used
  • Update command documentation with new option
  • Add tests for the new option
  • Document method parameters and putenv() usage
  • Change flag to interaction with default true (WP-CLI converts --no-interaction to --interaction=false)
  • Keep --no-interaction usage in tests
  • Fix test to use real package name from package index

Implementation Details

The flag is implemented as interaction with a default value of true:

  • Code checks for interaction flag with default true
  • When interaction is false, non-interactive mode is enabled
  • Tests use --no-interaction which WP-CLI automatically converts to --interaction=false
  • Documentation uses [--interaction] syntax

Test Fix

Changed the install test to use wp-cli/restful instead of wp-cli/test-package. The package name must match a real package in the package index, as the code validates against it.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add option to be non-interactive.</issue_title>
<issue_description>See #60 (review)

Composer supports being run non-interactively so it could be useful to have an option to set this.

In particular it would avoid getting prompted for one's ssh password as can happen depending on one's authorization settings, which is problematic for scripts.</issue_description>

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

@schlessera Yes, agree, we can simply forward such an option. It's an easy addition.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 2, 2025 15:36
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 option for non-interactive mode Add --no-interaction flag to prevent Git/SSH prompts in package commands Nov 2, 2025
Copilot AI requested a review from swissspidy November 2, 2025 15:42
@codecov
Copy link

codecov bot commented Nov 2, 2025

Codecov Report

❌ Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Package_Command.php 0.00% 15 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy

This comment was marked as resolved.

… in tests

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

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 command:package-install Related to 'package install' command command:package-uninstall Related to 'package uninstall' command command:package-update Related to 'package update' command labels Nov 2, 2025
@swissspidy swissspidy marked this pull request as ready for review November 2, 2025 17:06
@swissspidy swissspidy requested a review from a team as a code owner November 2, 2025 17:06

This comment was marked as resolved.

swissspidy and others added 6 commits December 19, 2025 13:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:package-install Related to 'package install' command command:package-uninstall Related to 'package uninstall' command command:package-update Related to 'package update' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to be non-interactive.

2 participants