-
Notifications
You must be signed in to change notification settings - Fork 247
feat(cli): warn when project-local CLI is missing #2362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fengmk2
merged 10 commits into
voidzero-dev:main
from
liangmiQwQ:liang/codex/warn-missing-local-cli
Aug 10, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0ad8765
feat(cli): warn when project-local CLI is missing
liangmiQwQ 5440075
docs(rfc): document global CLI fallback
liangmiQwQ 4e21d37
Merge branch 'main' into liang/codex/warn-missing-local-cli
liangmiQwQ eeb4a77
fix(cli): refine missing-local fallback warnings
liangmiQwQ da7e3ce
fix(cli): correct missing-local install guidance
liangmiQwQ a56010a
fix(cli): detect ancestor vite-plus declarations
liangmiQwQ a33485b
wip
liangmiQwQ 824cff8
Merge branch 'main' into liang/codex/warn-missing-local-cli
liangmiQwQ db7462e
Merge branch 'main' into liang/codex/warn-missing-local-cli
liangmiQwQ 0878f7f
Merge branch 'main' into liang/codex/warn-missing-local-cli
fengmk2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...apshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/assert-silent-fallback.mjs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { spawnSync } from 'node:child_process' | ||
|
|
||
| const result = spawnSync('vp', ['lint', '--help'], { encoding: 'utf8' }) | ||
| const output = `${result.stdout}${result.stderr}` | ||
|
|
||
| if (result.error) | ||
| throw result.error | ||
|
|
||
| if (result.status !== 0 || !output.includes('Usage: vp lint')) | ||
| throw new Error(`Global CLI did not run successfully:\n${output}`) | ||
|
|
||
| if (output.includes('No project-local vite-plus installation was found')) | ||
| throw new Error(`Unexpected missing local CLI warning:\n${output}`) | ||
|
|
||
| console.log('Global fallback remained silent.') |
4 changes: 4 additions & 0 deletions
4
crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/package.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "name": "missing-local-cli-warning", | ||
| "version": "1.0.0" | ||
| } |
12 changes: 12 additions & 0 deletions
12
...es/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [[case]] | ||
| name = "missing_local_cli_warning" | ||
| vp = "global" | ||
| skip-platforms = ["windows"] | ||
| steps = [ | ||
| { argv = ["vpt", "write-file", "node_modules/vite-plus/package.json", '{"name":"vite-plus","version":"0.0.0"}'], snapshot = false }, | ||
| { argv = ["vp", "lint", "src/index.js"], comment = "a project that does not declare vite-plus gets migration guidance" }, | ||
| { argv = ["vpt", "json-edit", "package.json", "devDependencies.vite-plus", "0.0.0"], snapshot = false }, | ||
| { argv = ["vp", "lint", "src/index.js"], comment = "a project that declares vite-plus but has no local CLI gets installation guidance" }, | ||
| { argv = ["vpt", "rm", "package.json"], snapshot = false }, | ||
| { argv = ["node", "assert-silent-fallback.mjs"], comment = "outside a project, global fallback remains silent" }, | ||
| ] |
42 changes: 42 additions & 0 deletions
42
...shots/fixtures/missing_local_cli_warning/snapshots/missing_local_cli_warning.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # missing_local_cli_warning | ||
|
|
||
| ## `vpt write-file node_modules/vite-plus/package.json '{"name":"vite-plus","version":"0.0.0"}'` | ||
|
|
||
|
|
||
| ## `vp lint src/index.js` | ||
|
|
||
| a project that does not declare vite-plus gets migration guidance | ||
|
|
||
| ``` | ||
| VITE+ - The Unified Toolchain for the Web | ||
|
|
||
| warn: This project does not use vite-plus. Learn how to migrate: https://viteplus.dev/guide/migrate | ||
| Found 0 warnings and 0 errors. | ||
| Finished in <duration> on 1 file with <n> rules using <n> threads. | ||
| ``` | ||
|
|
||
| ## `vpt json-edit package.json devDependencies.vite-plus 0.0.0` | ||
|
|
||
|
|
||
| ## `vp lint src/index.js` | ||
|
|
||
| a project that declares vite-plus but has no local CLI gets installation guidance | ||
|
|
||
| ``` | ||
| VITE+ - The Unified Toolchain for the Web | ||
|
|
||
| warn: No project-local vite-plus installation was found. Run `vp install` in `<workspace>` to install dependencies. | ||
| Found 0 warnings and 0 errors. | ||
| Finished in <duration> on 1 file with <n> rules using <n> threads. | ||
| ``` | ||
|
|
||
| ## `vpt rm package.json` | ||
|
|
||
|
|
||
| ## `node assert-silent-fallback.mjs` | ||
|
|
||
| outside a project, global fallback remains silent | ||
|
|
||
| ``` | ||
| Global fallback remained silent. | ||
| ``` | ||
1 change: 1 addition & 0 deletions
1
crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/src/index.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const answer = 42 |
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.