Skip to content

Fix child-theme scaffold error when --path contains relative segments#384

Merged
swissspidy merged 4 commits intomainfrom
copilot/fix-child-theme-error-with-path-argument
Apr 21, 2026
Merged

Fix child-theme scaffold error when --path contains relative segments#384
swissspidy merged 4 commits intomainfrom
copilot/fix-child-theme-error-with-path-argument

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 21, 2026

  • Fix check_target_directory to canonicalize both sides of theme/plugin directory comparisons
  • Use canonicalized paths in error messages for consistency and readability
  • Add Behat test scenario using --path=.. to exercise the regression
  • Run validation (lint/phpcs/phpstan) — all pass

Copilot AI linked an issue Apr 21, 2026 that may be closed by this pull request
@github-actions github-actions Bot added bug command:scaffold-child-theme Related to 'scaffold child-theme' command scope:testing Related to testing state:unconfirmed labels Apr 21, 2026
Copilot AI changed the title [WIP] Fix child theme error when using --path argument Fix child-theme scaffold error when --path contains relative segments Apr 21, 2026
Copilot AI requested a review from swissspidy April 21, 2026 08:44
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review April 21, 2026 10:35
@swissspidy swissspidy requested a review from a team as a code owner April 21, 2026 10:35
Copilot AI review requested due to automatic review settings April 21, 2026 10:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes wp scaffold child-theme failing when --path includes relative segments like .. by canonicalizing both sides of the directory comparisons used to validate the target directory, and adds a Behat scenario intended to cover this regression.

Changes:

  • Canonicalize WP_CONTENT_DIR . '/themes' before comparing to the canonicalized target directory parent.
  • Canonicalize WP_PLUGIN_DIR before comparing to the canonicalized target directory parent.
  • Add a Behat scenario intended to ensure scaffolding works when invoked from outside the install directory.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Scaffold_Command.php Canonicalizes expected theme/plugin directories before comparing against the canonicalized target directory.
features/scaffold.feature Adds a Behat scenario intended to cover relative-path (..) behavior for wp scaffold child-theme.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread features/scaffold.feature Outdated
Comment thread src/Scaffold_Command.php Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@swissspidy swissspidy merged commit 37403a4 into main Apr 21, 2026
62 checks passed
@swissspidy swissspidy added this to the 2.5.6 milestone Apr 21, 2026
@swissspidy swissspidy deleted the copilot/fix-child-theme-error-with-path-argument branch April 21, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:scaffold-child-theme Related to 'scaffold child-theme' command scope:testing Related to testing state:unconfirmed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

child-theme throws an error if the --path argument is set

3 participants