Skip to content

Add more verbose debug output#207

Merged
swissspidy merged 10 commits intomainfrom
copilot/add-verbose-flag-checks
Mar 10, 2026
Merged

Add more verbose debug output#207
swissspidy merged 10 commits intomainfrom
copilot/add-verbose-flag-checks

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

Implementation Plan: Add debug output for doctor check command

  • Explore repository structure and understand the codebase
  • Implement debug logging using WP_CLI::debug() with 'doctor' group
  • Add debug output when checks are being executed
  • Add debug output for file checks (which can be slow on large sites)
  • Create Behat tests for the --debug=doctor flag
  • Address code review feedback (extract magic number to constant)
  • Run security checks
  • Fix failing test (use cache-flush instead of php-in-upload)
  • Address misleading file count wording (use "items visited" terminology)
  • Final verification

Summary

Successfully implemented debug output for the wp doctor check command using WP-CLI's built-in --debug=doctor flag. This addresses the reported issue where large WordPress sites appeared to hang during checks by providing detailed visibility into check execution.

Key Features:

  • Shows which check is currently running (when using --debug=doctor)
  • Displays status after each check completes
  • For file checks, shows scanning progress every 1000 items (using "items visited" terminology for accuracy)
  • Debug output goes to STDERR, never corrupts machine-readable output formats
  • Leverages existing WP-CLI infrastructure instead of custom flag implementation
  • All changes are backward compatible (opt-in feature)

Usage:

wp doctor check --all --debug=doctor

Code Quality:

  • ✅ Passes all static analysis checks (lint, phpcs, phpstan)
  • ✅ Uses WP_CLI::debug() with 'doctor' group (consistent with existing codebase)
  • ✅ Test coverage using --debug=doctor and checking STDERR
  • ✅ Wording changed to "items visited" for accuracy (addresses that directories are also counted)
  • ✅ No custom format checking needed (debug output automatically goes to STDERR)
  • ✅ Follows existing codebase conventions
Original prompt

This section details on the original issue you should resolve

<issue_title>Introduce --verbose flag to provide more visibility into what checks are doing</issue_title>
<issue_description>Run wp doctor check command as follows:
[root@server production]# wp doctor check --all --allow-root

Check begins but never gets past 12%

Running checks 12 % [====================> ] 0:16 / 2:15[root@server production]#

Expected behavior is that it completes or returns an error message.

Ideally a fix would complete the scan, alternatively provide a verbose error message.

Thanks!

PHP 8.0, WP 6.0.3, updated to latest production version of WP CLI and doctor package.
Large WP site, 30,000 posts, 200,000 comments. 16GB 4CPU VPS on centos/apache</issue_description>

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

@danielbachhuber Thanks for the report, @bozzmedia !

I imagine it's processing a large body of data (files or in your database) for a specific check, and is slow to update the progress indicator.

It would be nice to have a --verbose flag that gives you more visibility into what each check is doing.</comment_new>


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

Copilot AI and others added 2 commits February 12, 2026 22:39
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] Introduce --verbose flag to improve check visibility Add --verbose flag to doctor check command Feb 12, 2026
Copilot AI requested a review from swissspidy February 12, 2026 22:43
@swissspidy

This comment was marked as resolved.

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

This comment was marked as resolved.

@codecov

This comment was marked as resolved.

This comment was marked as resolved.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
@swissspidy swissspidy marked this pull request as ready for review March 10, 2026 16:18
@swissspidy swissspidy requested a review from a team as a code owner March 10, 2026 16:18
@swissspidy

This comment was marked as resolved.

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

This comment was marked as resolved.

@swissspidy
Copy link
Member

@copilot instead of a --verbose argument, why not make use of WP_CLI::debug(). With the second argument set to doctor, one can use --debug=doctor. Then we don't have to worry about the table formatting either.

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

This comment was marked as resolved.

Copilot AI changed the title Add --verbose flag to doctor check command Add debug output to doctor check command using --debug=doctor Mar 10, 2026
@swissspidy swissspidy changed the title Add debug output to doctor check command using --debug=doctor Add more verbose debug output Mar 10, 2026
@swissspidy swissspidy added this to the 2.3.0 milestone Mar 10, 2026
@swissspidy swissspidy merged commit 0ac574b into main Mar 10, 2026
59 checks passed
@swissspidy swissspidy deleted the copilot/add-verbose-flag-checks branch March 10, 2026 20:57
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.

Introduce --verbose flag to provide more visibility into what checks are doing

3 participants