Repository navigation
fix(cli): match any env sourcing spelling and skip comments in profile detection - #3660
Merged
Merged
Conversation
Contributor
|
✅ Staging deployment successful! Preview: https://viteplus-staging.void.app/ |
Contributor
CLI artifact sizes (
|
| Artifact | Format | Base | PR | Change |
|---|---|---|---|---|
packages/cli/dist |
Directory total | 2.52 MiB | 2.52 MiB | 0 B (0.00%) |
packages/core/dist |
Directory total | 4.29 MiB | 4.29 MiB | 0 B (0.00%) |
| Combined package dist | Directory total | 6.81 MiB | 6.81 MiB | 0 B (0.00%) |
vp (Linux x64) |
Binary | 9.30 MiB | 9.31 MiB | +8.00 KiB (+0.08%) |
vp (Linux x64) |
gzip -9 | 4.25 MiB | 4.26 MiB | +4.62 KiB (+0.11%) |
| NAPI (Linux x64) | Binary | 37.99 MiB | 37.99 MiB | 0 B (0.00%) |
| NAPI (Linux x64) | gzip -9 | 15.33 MiB | 15.33 MiB | 0 B (0.00%) |
vp (macOS ARM64) |
Binary | 6.11 MiB | 6.12 MiB | +16.19 KiB (+0.26%) |
vp (macOS ARM64) |
gzip -9 | 3.64 MiB | 3.65 MiB | +3.62 KiB (+0.10%) |
| NAPI (macOS ARM64) | Binary | 44.39 MiB | 44.39 MiB | 0 B (0.00%) |
| NAPI (macOS ARM64) | gzip -9 | 19.42 MiB | 19.42 MiB | 0 B (0.00%) |
vp (Windows x64) |
Binary | 7.26 MiB | 7.27 MiB | +8.50 KiB (+0.11%) |
vp (Windows x64) |
gzip -9 | 3.33 MiB | 3.33 MiB | +6.15 KiB (+0.18%) |
| NAPI (Windows x64) | Binary | 33.88 MiB | 33.88 MiB | 0 B (0.00%) |
| NAPI (Windows x64) | gzip -9 | 14.04 MiB | 14.04 MiB | -1 B (-0.00%) |
| Trampoline (Windows x64) | Binary | 13.50 KiB | 13.50 KiB | 0 B (0.00%) |
| Trampoline (Windows x64) | gzip -9 | 7.09 KiB | 7.09 KiB | 0 B (0.00%) |
| Installer (Windows x64) | Binary | 4.70 MiB | 4.70 MiB | 0 B (0.00%) |
| Installer (Windows x64) | gzip -9 | 2.25 MiB | 2.25 MiB | +1 B (+0.00%) |
|
Cloudflare builds and deploys previews for this pull request. Learn more about Cloudflare previews.
Updated: |
fengmk2
force-pushed
the
triagebot/fix-3659
branch
from
December 5, 2026 13:45
c427ffa to
ae66f88
Compare
Replace the substring matcher and per-caller spelling lists with one
`profile_sources_env` helper in `commands/shell.rs`. It splits each
profile line into shell words, removes quotes, resolves backslash
escapes, expands `$HOME`, `${HOME}` and a leading `~`, and compares the
argument of a `.` or `source` command with the absolute env file path.
`vp env doctor`, first-use setup and the `vp env setup` guidance check
all use it.
The matcher now also accepts `then . ...`, Fish `; and source ...`, a
tab after `.`, and redirects after the path. It rejects lines that only
print the path, such as `echo "hint; . $HOME/..."`. Doctor also finds
the escaped line that vp writes for a home path with `$` or a backtick.
Revert the `install-legacy.sh` change: that script runs only for old
binaries without self-setup support.
Closes #3659
Pass the profile's shell to `profile_sources_env` through a new `ShellProfile::shell()`: - Only Nushell expands a quoted leading `~`. Bash, Zsh and Fish keep `source "~/..."` literal, so the line no longer counts as configured. - Nushell keeps `$` literal in strings and paths. - POSIX and Fish profiles may put `--` between `.` or `source` and the file name. - POSIX profiles may name the env file through a variable from an earlier `NAME=value` or `export NAME=value` line. A later assignment replaces the value, and an assignment that the check cannot resolve, such as `$(...)`, clears it.
A variable now holds every value that it can have at a line: - An assignment after `&&`, `||`, `|` or `&`, or in an `if`, `case`, `for`, `select`, `while` or `until` block, adds its value. An unconditional assignment replaces the earlier values. This keeps `vp_env=...; [ -f "$vp_env" ] || vp_env=...` configured. - In POSIX and Fish profiles, `for NAME in WORD...` gives `NAME` each listed value, so a loop that sources `"$f"` counts. A `.` or `source` command counts when any value of its argument is the env file. One word or variable keeps at most 64 values. Nushell profiles also accept backtick quotes, as in `source `~/My Tools/vite-plus/env.nu``.
Split the whole profile at once and treat a newline as a command separator. A backslash before a newline joins the lines, outside quotes and in double quotes, so a `for f in \` list keeps all its values. A newline after `&&`, `||` or `|` does not end the command, so a fallback assignment on the next line stays conditional. A comment still ends at its newline, and a backslash in single quotes stays in the word. A quote ends at the end of its line, so that an apostrophe in a heredoc cannot hide the rest of the profile. Nushell keeps `\` literal.
fengmk2
force-pushed
the
triagebot/fix-3659
branch
from
December 5, 2026 16:37
86afe4a to
fa66046
Compare
Add `ShellProfile::sources_env` so doctor, setup and first-use setup no longer build the env file path and home string themselves, and make `profile_sources_env` private. In the scanner, skip words that do not start a command before expanding them, expand the `.`/`source` argument once, and keep the command prefix words in one constant. Derive the word state in the splitter from the word itself instead of a separate flag, use `std::path::is_separator`, and stop collecting `for` values past the value limit. Trim caller tests that repeat the matcher tests.
fengmk2
approved these changes
Dec 5, 2026
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.
vpchecked whether a shell profile sources its env file with substring checks.vp env doctorreported working lines such as. "$HOME"/.config/vite-plus/envand. ${HOME}/.config/vite-plus/envas missing, and first-use setup appended a second sourcing block. A commented-out line counted as configured.profile_sources_envincommands/shell.rsnow splits the profile into shell commands with the rules of the profile's shell. A backslash before a newline, or a trailing&&,||or|, continues a command on the next line. The check removes quotes, resolves backslash escapes, expands$HOME,${HOME}and a leading~, skips one--, and compares the argument of a.orsourcecommand with the absolute env file path.vp env doctor, first-use setup and thevp env setupguidance check use it.install-legacy.shstays unchanged: it runs only for old binaries without self-setup support.A variable expands to every value that it can hold. POSIX
NAME=valueandexport NAME=valueset it, an assignment after&&or||or inside anifblock adds a value, andfor NAME in ...gives each listed value. The command counts when any value matches. Nushell profiles also accept backtick quotes, expand a quoted~, and keep$literal.Closes #3659
Automated triage bot fix (AI-assisted).