Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 10, 2026

Command namespaces (classes extending WP_CLI\Dispatcher\CommandNamespace) produce empty sections in generated READMEs with no descriptions or documentation. Example: https://github.com/wp-cli/makepot-command/blob/490b759/README.md#wp-i18n

Changes

  • Skip commands not found in registry: Commands that don't exist in the current WP-CLI installation ($parent_command === false) are now excluded
  • Skip command namespaces: Commands with subcommands but empty shortdesc and longdesc are detected and filtered out before README rendering
  • Test coverage: Added scenario verifying namespace exclusion behavior

Implementation

Detection occurs before longdesc processing to catch namespaces accurately:

// Skip commands not found
if ( false === $parent_command ) {
    continue;
}

// Skip namespaces: composite commands with no content
$has_subcommands = ! empty( $parent_command['subcommands'] );
$shortdesc       = $parent_command['description'] ?? '';
$raw_longdesc    = $parent_command['longdesc'] ?? '';
$is_namespace    = $has_subcommands && empty( trim( $shortdesc ) ) && empty( trim( $raw_longdesc ) );

if ( $is_namespace ) {
    continue;
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.wordpress.org
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
    • Triggering command: /usr/bin/curl curl -s REDACTED git ge-c�� --verify main tnet/tools/git (dns block)
    • Triggering command: /usr/bin/curl curl -s REDACTED bash at.y�� --noprofile (dns block)
  • wp-cli.org
    • Triggering command: /usr/bin/php /usr/bin/php /home/REDACTED/work/scaffold-package-command/scaffold-package-command/vendor/wp-cli/wp-cli/bin/../php/boot-fs.php scaffold package wp-cli/default-readme 'features/scaffold-package-readme.feature' '--name=README excludes command namespaces' -- and/vendor/bin/sh --name=README exwhich 10 /usr/sbin/php which and/�� . php tnet/tools/bash ext\FeatureContesh (dns block)
    • Triggering command: /usr/bin/php /usr/bin/php /home/REDACTED/work/scaffold-package-command/scaffold-package-command/vendor/wp-cli/wp-cli/bin/../php/boot-fs.php scaffold package wp-cli/custom-branch -- grep '@require-e--strict sh .feature amespaces /usr/bin/sh which old-�� (dns block)
    • Triggering command: /usr/bin/php /usr/bin/php /home/REDACTED/work/scaffold-package-command/scaffold-package-command/vendor/wp-cli/wp-cli/bin/../php/boot-fs.php scaffold package wp-cli/foo --dir=foo --require_wp_cli=>=0.24.0-alpha hp --noprofile (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Command namespaces do not produce meaningful README content</issue_title>
<issue_description>When scaffolding a README file through the wp scaffold package-readme command, the command namespaces do not produce any meaningful result.

Here's an example output: https://github.com/wp-cli/makepot-command/blob/490b759eb0fe0a4c09d350ba7262d0b0a558248a/README.md#wp-i18n</issue_description>

<agent_instructions>In the wp scaffold package-readme command, exclude command namespaces (classes extending WP_CLI\Dispatcher\CommandNamespace)</agent_instructions>

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

@swissspidy Just looking at this and noticing that we're a bit inconsistent with namespaces in readmes.

For example in entity-command the network namespace isn't listed in composer.json, so it's not in the readme. But in other commands like i18n-command, embed-command, language-command it is. We should probably add it anywhere, because that list is also used to populate GitHub issues labels.

Then, in wp scaffold package-readme, I'd say we simply exclude namespaces (classes extending WP_CLI\Dispatcher\CommandNamespace).</comment_new>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix README content generation for command namespaces Exclude command namespaces from README generation Jan 10, 2026
Copilot AI requested a review from swissspidy January 10, 2026 11:31
@github-actions
Copy link
Contributor

Hello! 👋

Thanks for opening this pull request! Please check out our contributing guidelines. We appreciate you taking the initiative to contribute to this project.

Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

@swissspidy swissspidy added this to the 2.2.1 milestone Jan 10, 2026
@swissspidy swissspidy closed this Jan 12, 2026
@swissspidy swissspidy deleted the copilot/fix-readme-command-namespaces branch January 12, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command namespaces do not produce meaningful README content

2 participants