From 82a2074bdbccf37b6fc37ddaa28cfae695f952ff Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Jun 2026 11:36:49 +0000 Subject: [PATCH 1/4] Initial plan From d64f1d7aa83012f907f8db738a56bb635bed5260 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Jun 2026 11:41:36 +0000 Subject: [PATCH 2/4] Avoid package install side effects in README Behat scenarios Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/scaffold-package-readme.feature | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/features/scaffold-package-readme.feature b/features/scaffold-package-readme.feature index 585f86b..61dca91 100644 --- a/features/scaffold-package-readme.feature +++ b/features/scaffold-package-readme.feature @@ -94,7 +94,7 @@ Feature: Scaffold a README.md file for an existing package Scenario: Scaffold a README.md requiring a nightly build Given an empty directory - When I run `wp scaffold package wp-cli/foo --dir=foo --require_wp_cli='>=0.24.0-alpha'` + When I run `wp scaffold package wp-cli/foo --dir=foo --require_wp_cli='>=0.24.0-alpha' --skip-install` Then STDOUT should contain: """ Success: Created package readme. @@ -110,16 +110,10 @@ Feature: Scaffold a README.md file for an existing package """ Installing this package requires WP-CLI v0.24.0-alpha or greater. Update to the latest nightly release with `wp cli update --nightly`. """ - When I run `wp package uninstall wp-cli/foo` - Then STDOUT should contain: - """ - Success: Uninstalled package. - """ - Scenario: Scaffold a README.md requiring the latest stable release Given an empty directory - When I run `wp scaffold package wp-cli/foo --dir=foo --require_wp_cli='*'` + When I run `wp scaffold package wp-cli/foo --dir=foo --require_wp_cli='*' --skip-install` Then STDOUT should contain: """ Success: Created package readme. @@ -135,12 +129,6 @@ Feature: Scaffold a README.md file for an existing package """ Installing this package requires WP-CLI's latest stable release. Update to the latest stable release with `wp cli update`. """ - When I run `wp package uninstall wp-cli/foo` - Then STDOUT should contain: - """ - Success: Uninstalled package. - """ - Scenario: Scaffold a readme with custom shields Given an empty directory And a foo/composer.json file: From 12a3ce85a6515d3ae5b879e3f6f795a495ed986f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Jun 2026 14:22:51 +0000 Subject: [PATCH 3/4] Fix Windows README Behat failures by using package-readme fixtures Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/scaffold-package-readme.feature | 28 ++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/features/scaffold-package-readme.feature b/features/scaffold-package-readme.feature index 61dca91..af177ae 100644 --- a/features/scaffold-package-readme.feature +++ b/features/scaffold-package-readme.feature @@ -94,7 +94,17 @@ Feature: Scaffold a README.md file for an existing package Scenario: Scaffold a README.md requiring a nightly build Given an empty directory - When I run `wp scaffold package wp-cli/foo --dir=foo --require_wp_cli='>=0.24.0-alpha' --skip-install` + And a foo/composer.json file: + """ + { + "name": "wp-cli/foo", + "require": { + "wp-cli/wp-cli": ">=0.24.0-alpha" + } + } + """ + + When I run `wp scaffold package-readme foo` Then STDOUT should contain: """ Success: Created package readme. @@ -103,7 +113,7 @@ Feature: Scaffold a README.md file for an existing package """ "require": { "wp-cli/wp-cli": ">=0.24.0-alpha" - }, + } """ And the foo/README.md file should exist And the foo/README.md file should contain: @@ -113,7 +123,17 @@ Feature: Scaffold a README.md file for an existing package Scenario: Scaffold a README.md requiring the latest stable release Given an empty directory - When I run `wp scaffold package wp-cli/foo --dir=foo --require_wp_cli='*' --skip-install` + And a foo/composer.json file: + """ + { + "name": "wp-cli/foo", + "require": { + "wp-cli/wp-cli": "*" + } + } + """ + + When I run `wp scaffold package-readme foo` Then STDOUT should contain: """ Success: Created package readme. @@ -122,7 +142,7 @@ Feature: Scaffold a README.md file for an existing package """ "require": { "wp-cli/wp-cli": "*" - }, + } """ And the foo/README.md file should exist And the foo/README.md file should contain: From 799081602da284f9927fdcf7c58b7cf892f27bc1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Jun 2026 16:09:54 +0000 Subject: [PATCH 4/4] Fix Windows HOME path detection and mock remote readme body Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/scaffold-package-readme.feature | 14 ++++++++++++++ src/ScaffoldPackageCommand.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/features/scaffold-package-readme.feature b/features/scaffold-package-readme.feature index af177ae..86825be 100644 --- a/features/scaffold-package-readme.feature +++ b/features/scaffold-package-readme.feature @@ -190,6 +190,13 @@ Feature: Scaffold a README.md file for an existing package Scenario: Scaffold a readme with a remote support body Given an empty directory + And that HTTP requests to https://gist.githubusercontent.com/danielbachhuber/bb652b1b744cea541705ee9c13605dad/raw/195c17ebb8cf25e947a9df6e02de1e96a084c287/support.md will respond with: + """ + HTTP/1.1 200 OK + Content-Type: text/plain + + Support isn't free! + """ And a foo/composer.json file: """ { @@ -217,6 +224,13 @@ Feature: Scaffold a README.md file for an existing package Scenario: Scaffold a readme with a pre, post and body for the section Given an empty directory + And that HTTP requests to https://gist.githubusercontent.com/danielbachhuber/bb652b1b744cea541705ee9c13605dad/raw/195c17ebb8cf25e947a9df6e02de1e96a084c287/support.md will respond with: + """ + HTTP/1.1 200 OK + Content-Type: text/plain + + Support isn't free! + """ And a foo/composer.json file: """ { diff --git a/src/ScaffoldPackageCommand.php b/src/ScaffoldPackageCommand.php index 9929298..b6957e0 100644 --- a/src/ScaffoldPackageCommand.php +++ b/src/ScaffoldPackageCommand.php @@ -135,7 +135,7 @@ public function package( $args, $assoc_args ) { } // Convert to absolute path if relative. - if ( ! preg_match( '#^([a-zA-Z]:)?[\\/]#', $package_dir ) ) { + if ( ! preg_match( '#^([a-zA-Z]:)?[\\\\/]#', $package_dir ) ) { $cwd = getcwd(); if ( false === $cwd ) { WP_CLI::error( 'Could not determine current working directory.' );