[CLI-util] Replace Xdebug console logs with CLI output#3460
Conversation
|
8 |
There was a problem hiding this comment.
Is the override needed? How is it different from https://github.com/WordPress/wordpress-playground/pull/3460/changes#diff-ae690e75ffa76d3fb207dd35ee0b37f52f453b42882dbc607303fc9bb6aadd9eR73-R76
Let's replace the rest while we are working on it, otherwise in the future we will wonder if we should use console.log or CLIOutput. |
bgrgicak
left a comment
There was a problem hiding this comment.
I left a couple of comments that we should address before merging, but overall it works as expected.
b4bc306 to
799884e
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR standardizes CLI terminal output by introducing a shared CLIOutput base in @php-wasm/cli-util and migrating Xdebug-related messages away from raw console.log, improving consistency and maintainability across CLIs.
Changes:
- Added shared
CLIOutput(TTY-aware formatting + print helpers) to@php-wasm/cli-utilwith accompanying tests. - Updated
@php-wasm/cliand@wp-playground/clito useCLIOutputfor Xdebug messaging and removed duplicated inline ANSI helpers. - Refactored Playground CLI’s output class to extend the shared base class.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/playground/cli/src/run-cli.ts | Removes inline ANSI helpers, routes Xdebug + start-command output through CLIOutput. |
| packages/playground/cli/src/cli-output.ts | Refactors Playground output to extend shared base; trims duplicated formatter logic. |
| packages/php-wasm/cli/src/main.ts | Replaces Xdebug-related console.log with shared CLIOutput calls. |
| packages/php-wasm/cli-util/src/test/cli-output.spec.ts | Adds unit tests for shared CLIOutput formatting and output behavior. |
| packages/php-wasm/cli-util/src/lib/index.ts | Exports new shared CLIOutput from package entrypoint. |
| packages/php-wasm/cli-util/src/lib/cli-output.ts | Introduces shared CLIOutput implementation (formatters + print helpers). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
35eb157 to
b90cd42
Compare
|
@bero Thanks for the review! 3 new failing tests but they are not related to this pull request. I think I can merge. |
b90cd42 to
deb08c3
Compare
Motivation for the change, related issues
Both
@php-wasm/cliand@wp-playground/cliduplicate the same inline ANSI formatting helpers and use rawconsole.logcalls for Xdebug output. This makes the output inconsistent across CLIs and harder to maintain.This pull request extracts a shared
CLIOutputbase class into@php-wasm/cli-utiland replaces all Xdebug-relatedconsole.logcalls with it in both CLIs.Implementation details
@php-wasm/cli-util: provides TTY-aware ANSI formatting and generic output methods. Uses a configurable writeStream and respects a verbosity setting.@php-wasm/cli: removed standalone formatting functions and /* eslint-disable no-console */. ImportsCLIOutputfrom@php-wasm/cli-utildirectly. All Xdebugconsole.logcalls replaced withcliOutput.print().@wp-playground/cli: the existingCLIOutputclass now extends the base from@php-wasm/cli-util, removing its duplicated private formatting methods. Playground-specific methods remain. Standalone formatting functions inrun-cli.tsremoved. All Xdebugconsole.logcalls replaced withcliOutputmethod calls.CLIOutputclass covering formatting, output methods, quiet mode suppression, and getter behavior.Testing Instructions (or ideally a Blueprint)
CLI
🧪
packages/php-wasm/cli-util/src/test/cli-output.spec.ts