[CLI] make --no-auto-mount actually disable auto-detection on start#3503
Merged
[CLI] make --no-auto-mount actually disable auto-detection on start#3503
Conversation
The `start` command declared a literal `no-auto-mount` boolean option, which
collided with yargs-parser's built-in boolean-negation: `--no-auto-mount` was
parsed as `{ autoMount: false }` against an undefined `auto-mount` option,
so strictOptions rejected it with `Unknown arguments: auto-mount, autoMount`.
Rename the option to a naturally-negatable `auto-mount` boolean that defaults
to true, update `expandStartCommandArgs` to gate on `args.autoMount \!== false`,
and guard the shared `--auto-mount` path validation so it only runs for
subcommands where the option is a string path.
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes wp-playground start --no-auto-mount failing under strictOptions() by aligning the start command’s option definition with yargs-parser’s built-in boolean negation behavior.
Changes:
- Renames
start’sno-auto-mountoption toauto-mount(defaulttrue) so--no-auto-mountparses without “unknown arguments”. - Updates start-arg expansion to enable auto-mount unless
args.autoMount === false, and widensRunCLIArgs.autoMounttostring | boolean. - Adds an integration regression test covering
start --no-auto-mount.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/playground/cli/tests/run-cli.spec.ts | Adds regression/integration test asserting --no-auto-mount is accepted and skips automount detection. |
| packages/playground/cli/src/run-cli.ts | Updates yargs option definitions, shared validation, and start arg expansion to support boolean-negation semantics. |
| packages/playground/cli/src/mounts.ts | Adapts auto-mount expansion to the updated autoMount type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation for the change, related issues
The documented invocation
wp-playground start --no-auto-mountfails withUnknown arguments: auto-mount, autoMount, so there is no way to disable auto-detection on thestartcommand.Root cause: the
startcommand declared a literalno-auto-mountboolean option. yargs-parser's built-in boolean-negation (combined with camel-case-expansion) rewrites--no-auto-mountinto{ "auto-mount": false, autoMount: false }against an undefinedauto-mountoption. WithstrictOptions()enforced, those phantom keys get rejected as unknown.Implementation details
no-auto-mount(boolean, defaultfalse) toauto-mount(boolean, defaulttrue) on thestartcommand. yargs-parser's negation now matches a defined option, so--no-auto-mountparses cleanly as{ autoMount: false }— no phantom keys, no strictOptions rejection.--auto-mount=falseand--noAutoMountalso continue to work.expandStartCommandArgsto gate onargs.autoMount !== false. Because yargs stores the boolean in the sameautoMountproperty theservercommand uses for a string path, the boolean form is scrubbed before any downstream consumer sees it.RunCLIArgs.autoMounttostring | boolean(start = boolean toggle; server & friends = string path). Drop the now-unusedRunCLIArgs.noAutoMount. No public consumers ofnoAutoMountwere found inside the monorepo..check()path-validation block so the "not a directory" check only runs for subcommands where--auto-mountis a string. Otherwise thestartcommand's booleantruewould be fed tofs.statSync()and blow up.Alternative I considered but rejected: disabling
boolean-negationon the yargs instance. That would silently change the semantics of every other--no-Xflag in the CLI — broader blast radius than a targeted rename.Testing Instructions (or ideally a Blueprint)
Automated:
npx nx typecheck playground-clinpx nx lint playground-clinpx nx test-playground-cli playground-cli --testFile=mounts.spec.ts— confirms mount logic is untouched (20/20 pass).npx nx test-playground-cli playground-cli --testNamePattern="--no-auto-mount"— new integration test bootsstart --no-auto-mountviaparseOptionsAndRunCLI, asserts the server URL comes up, and asserts the sample-plugin directory is not mounted under/wordpress/wp-content/plugins/. Requires network (WordPress download), so it runs in CI rather than offline.Manual:
npx nx build playground-climy-plugin.phpwith aPlugin Name:header):wp-playground start --no-auto-mount --path=./— server boots; the plugin is not visible under/wordpress/wp-content/plugins/.wp-playground start --path=./— server boots; the plugin is auto-mounted and activated (default behavior, unchanged).wp-playground start --auto-mount=false --path=./— equivalent to--no-auto-mount.wp-playground start --noAutoMount --path=./— the legacy camelCase workaround still works.wp-playground start --helpshows--auto-mount(with its describe text noting--no-auto-mountdisables it) instead of the old--no-auto-mountentry.