feat: XDG directory layout via VpDirs - #2346
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
b8069a5 to
2f8be03
Compare
08b7589 to
4e2abdf
Compare
|
@liangmiQwQ Your refactor needs to wait until this merge is completed first, as the changes are expected to be quite significant. |
78a23b6 to
a433ed4
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
6b26e69 to
ca9dcca
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca9dcca689
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
IMO, I would be a little bit curious about the benefit for this move. The current For example, I help maintain the Vite+'s global package installations in several, I'm concerned that using I'm not against this direction, I just want to understand the motivation and the problem it solves. If it does help Vite+ improve, then now is really a good time to implement it (before RC). |
|
@liangmiQwQ Following the XDG directory convention will allow Vite+ to be more widely accepted, and many mature developer tools follow this convention, such as Claude Code and uv astral-sh/uv#8420 |
ad9d7dd to
5cc3b6c
Compare
|
@codex review |
Registry bridge build (
|
| Package | Version |
|---|---|
vite-plus |
0.0.0-commit.f679dcd3c606f87ede78ab9c232fcb2352ab9fce |
@voidzero-dev/vite-plus-core |
0.0.0-commit.f679dcd3c606f87ede78ab9c232fcb2352ab9fce |
Install the Vite+ CLI built from this commit, then migrate a project:
# macOS / Linux
curl -fsSL https://deploy-preview-2346--viteplus-preview.netlify.app/install.sh | VP_PR_VERSION=2346 bash# Windows (PowerShell)
$env:VP_PR_VERSION="2346"; irm https://deploy-preview-2346--viteplus-preview.netlify.app/install.ps1 | iexAfter installing, upgrade the current project's vite-plus to this test build with:
vp migrateOr point your package manager at the bridge registry https://registry-bridge.viteplus.dev/:
| Package manager | Registry config |
|---|---|
| npm / pnpm / Bun | .npmrc: registry=https://registry-bridge.viteplus.dev/ |
| Yarn (v2+) | .yarnrc.yml: npmRegistryServer: "https://registry-bridge.viteplus.dev/" |
Then pin the build (vite aliases to vite-plus-core; pnpm can use a catalog, npm an overrides entry):
{
"devDependencies": {
"vite-plus": "0.0.0-commit.f679dcd3c606f87ede78ab9c232fcb2352ab9fce",
"vite": "npm:@voidzero-dev/vite-plus-core@0.0.0-commit.f679dcd3c606f87ede78ab9c232fcb2352ab9fce"
}
}Implode only removes shims that resolve to this install's vp. Generated env files persist resolved VP_*_DIR. Legacy Windows wrappers pin VP_HOME to the data root. Upgrade-check cache moves to <CACHE>. Org-tarball cache goes through EnvConfig.
Independent VP_BIN_DIR / VP_DATA_DIR installs cannot be found by sibling-path probing. Write <name>.shim next to each trampoline and resolve vp.exe from that pointer. Align install.ps1 with Windows known folders so installer roots match EnvConfig.
install.sh now links <BIN>/vp to the absolute <DATA>/current/bin/vp path. The grandfather layout job still asserted the old relative ../current/bin/vp target.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f679dcd3c6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Fork `pull_request` runs get a read-only token, so `vp-binary-size.yml` gated every job to same-repo PRs. Fork PRs that change native inputs (for example #2346, which touches Cargo.lock and many crates) got no size report at all. Changes: - Drop the fork gate from the `inputs` job, so fork PRs run the native input compare and the base/head builds when inputs changed. - Let the `comment` job run for fork PRs. It always writes the size table to the job summary, and returns before the comment API calls when the PR head is a fork. - Keep the `cleanup` job same-repo only, because comment deletion needs a write token. Same-repo PRs keep the current behavior, summary plus sticky comment. Fork PRs get the report in the run's job summary. The build jobs receive no secrets, checkout uses `persist-credentials: false`, and the Rust cache save is disabled, so the untrusted fork code runs with the same exposure as the regular CI jobs that already run for fork PRs.
|
@naokihaba If you have time, could you help take a look at whether this change has any impact on Nushell's functionality? |
Avoid the PowerShell 5 $HOME collision in install.ps1. Require a matching <name>.shim before implode deletes Windows exes. Pin VP_HOME from the trampoline for single-root bin/data layouts. Write JetBrains node paths from getVpDirs(). Persist VP_HOME in dir_envs only when it is an absolute path.
|
@fengmk2 Sure, I'll check it. |
fengmk2
left a comment
There was a problem hiding this comment.
Blocking: installing an old release through the new installer can report success with an unusable global CLI
I tested the deployed Windows preview installer in a clean, isolated environment:
- Installer:
https://deploy-preview-2346--viteplus-preview.netlify.app/install.ps1 - Installer SHA-256:
976CC99AD08E02B70169E43D9548E645899CFD3C609959FB41C4723EB8C98CE3 - Requested version:
VP_VERSION=0.2.9 - Full dependency installation and managed Node.js enabled
The installer exited 0 and reported success, but the resulting global installation was not usable.
Observed
- The downloaded payload at
<split-data>\current\bin\vp.exeexited 0 and reportedvp v0.2.9. - The PATH-installed
<split-bin>\vp.exeexited 1 because the old trampoline looked for<root>\current\bin\vp.exeinstead of<root>\data\current\bin\vp.exe. <split-bin>\vp.shimcorrectly pointed to the split data root, but the old trampoline did not consume that sidecar.- The split bin root did not contain functional
vpr.exe,vpx.exe, or managednode.exeshims. - Running the old version's environment setup created a second, legacy
.vite-plustree. Itsvp.exeandnode.exeshims also failed because that tree had nocurrentpayload.
A successful direct invocation of the downloaded payload does not make the global installation valid; commands resolved through the installed PATH must work.
Expected contract
Please clarify and enforce one of these behaviors:
- Old releases are supported: the new installer must select a layout and shim format compatible with the requested release, likely the legacy monolithic layout for pre-
VpDirsversions. The installedvp,vpr,vpx, Node, and npm commands must all work. - Old releases are unsupported: reject the request before creating partial state, exit nonzero, and print an actionable compatibility message.
Exiting 0 with a mixed split/legacy installation and broken PATH commands is a failure under either contract.
This result is confirmed on Windows for install.ps1. Since install.sh exposes the same VP_VERSION contract, it should receive equivalent old-version coverage on Linux and macOS before merge, without assuming that the Windows trampoline failure reproduces identically on Unix.
|
I will take over this PR and fix the issues discovered during the testing process. |
Close #827
Summary
Centralize on-disk paths in
vp_shared::VpDirsand default fresh installs to the split XDG/platform layout. Existing default installs under~/.vite-plusremain on the legacy monolithic root for now (grandfathered via existence-gated resolution). Automatic layout migration is out of scope here and tracked as follow-up work.Resolution (high level)
Ordered sources (per category): deprecated
VP_HOME(custom full-root pin) → existing~/.vite-plus(exist-gated legacy mapping) →VP_BIN_DIR/VP_DATA_DIR/VP_CACHE_DIR→XDG_*→ platform defaults.~/.vite-plus)~/.local/bin<root>/bin~/.local/share/vite-plus<root>~/.cache/vite-plus<root>/cache~/.config/vite-plus<root>~/.local/state/vite-plus<root>Windows split uses
%LOCALAPPDATA%\vite-plus\{bin,data,cache,state}and%APPDATA%\vite-plusfor config. RelativeVP_*/XDG_*values are treated as unset.Commits (review order)
docs(rfc): document split directory layout via VpDirsrfcs/directory-layout.mddescribing the resolution chain, grandfathering, installer alignment, and follow-ups (VP_HOMEcleanup, migrate-on-upgrade).env-command.md) are left unchanged.feat(shared): introduce VpDirs with strategy-gated path resolutionget_vp_home/home.rswithVpDirs+dirs/resolution.rsstrategy chain.current,js_runtime, …) stay as joins on the owning feature.EnvConfigso tests isolate layout viawith_vars/scopedwithout process-env leaks.AGENTS.mdpointer to the central path API.refactor(cli): route on-disk paths through VpDirsjs_runtime, package manager, implode, env setup/doctor, and related helpers ontoEnvConfig::get().dirs.dir_envs); implode deletes deduped{data, cache, config, state}and neverrm -rfs a shared bin dir.feat(install): default installers to the split XDG layoutinstall.sh/install.ps1/vp-setup/ trampoline /install-global-cliinstall into the rootsEnvConfigalready resolved. Fresh install → split; existing~/.vite-plusor--install-dir→ monolithic root.EnvConfig.vp-setupdoes not readVP_HOME/VP_*_DIR/XDG_*itself. A localvpbinary reports<DATA>/<BIN>/<CONFIG>viaVP_DUMP_DIRS=1so scripts andinstall-global-clido not re-implement the chain.vpshims target<DATA>/current/bin/vp(not a version dir) afterenv setup --refresh. The Windows trampoline finds../currentor../data/currentfrom disk layout only.VP_HOME-pinned; a local-build job covers fresh split + grandfather.User impact
~/.vite-plusVP_HOME~/.local/binneeds to be on PATHFollow-up
VP_HOMEusage in the repo (especially PTY snapshot tests); preferVP_*_DIR/ XDGvp upgrade, migrate default~/.vite-pluscontents into splitVP_*_DIR/XDG_*/ platform dirs and remove the legacy rootTest plan
cargo check/ unit tests fordirsresolution and layout helpersVP_HOME/ disable shared seed where fakes are used)install.sh/install.ps1)install-global-clivp-setup/ trampoline / Unix shim unit tests for fresh split vs grandfathertest-standalone-install(releasedVP_HOME-pinned + local-build split/grandfather jobs)~/.vite-plusstill works without moving