Error when scaffold package-readme commands are not loaded #271
+3
−7
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.
Plan to fix missing command error in scaffold package-readme
Summary
The fix ensures that when
wp scaffold packagecreates a new package and callsscaffold package-readme, the command is properly loaded via the automatically createdwp-cli.ymlfile. Usinglaunch => truespawns a new WP-CLI process that reads the wp-cli.yml configuration from the package directory.Original prompt
This section details on the original issue you should resolve
<issue_title>When running
wp scaffold package-readme, the output ofREADME.mdis incomplete if the custom package is not installed</issue_title><issue_description>## Bug Report
Describe the current, buggy behavior
I created a custom package containing a command named "bzmn." When I am in the directory containing the source, and I run
wp scaffold package-readme ., the output inREADME.mdis substantially truncated. For an example, please refer to README - without bzmn custom command installed.md. Command descriptions, options, and examples are all absent.If I install the
bzmncustom command viawp package install ., then runwp scaffold package-readme ., the output is complete. For an example, please refer to README - with bzmn custom command installed.md.If you diff the files, the issue is glaring.
It seems to be the case that the README information is only correct (comprehensive, as in the second example) if the custom package is installed on the system. If it isn't installed, you get the incomplete "style" of README, as in the first example. Is that behaviour intentional? If so, is that desirable? My expectation is that the
wp scaffold package-readme .command only sees and operates on the files in the current directory. If the developer's custom package needs to be installed for the package-readme subcommand to work, it may be helpful to note that in the documentation.Since a developer running the command to generate the README probably already has the package installed, this issue may have been overlooked. I only encountered the issue when creating a Docker container to automatically generate the README. The container, of course, didn't have my custom package pre-installed, and it took a bit of time to figure out why the command output wasn't the same as on my local computer, when the commands themselves were identical.
Let us know what environment you are running this on
The output of
wp --info:Then, when you run
wp scaffold package-readme .in your package folder, WP-CLI will read that file and load your command. The generated README then has the full contents in it as expected, I just tested it.Tip: if you wanna keep the "There are a few automated processes. [...]" section at the end, check out the note regarding custom sections.</comment_new>
<comment_new>@swissspidy
It loads some information from
composer.json, yes. S...wp scaffold package-readme, the output ofREADME.mdis incomplete if the custom package is not installed #270💡 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.