Skip to content

fix(cli): preserve hook PATH after directory changes - #3451

Open
voidzero-bot[bot] wants to merge 4 commits into
mainfrom
triagebot/fix-3450
Open

voidzero-bot[bot] wants to merge 4 commits into
mainfrom
triagebot/fix-3450

Conversation

@voidzero-bot

@voidzero-bot voidzero-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Hooks installed in a subdirectory lose access to local commands after cd because the dispatcher adds a relative node_modules/.bin to PATH.

The dispatcher now resolves that directory to an absolute path before it runs the hook. It clears CDPATH during resolution to prevent directory substitution and extra output, and stops if resolution fails. core.hooksPath remains relative so each linked worktree uses its own dispatcher and local commands.

Closes #3450

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://triagebot-fix-3450-viteplus-dev.voidzero-docs.workers.dev (commit af2e437)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://ead755c8-viteplus-dev.voidzero-docs.workers.dev af2e437 2026-11-17T02:48:15.939Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://729b303b-viteplus-dev.voidzero-docs.workers.dev d885c61 2026-11-16T18:40:56.716Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://80274f44-viteplus-dev.voidzero-docs.workers.dev dc607b0 2026-11-16T17:19:49.785Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://d032b6b8-viteplus-dev.voidzero-docs.workers.dev 405942f 2026-11-16T16:48:32.397Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://b98c8697-viteplus-dev.voidzero-docs.workers.dev 6814954 2026-11-13T20:26:32.659Z Visit the dashboard ↗

@fengmk2 fengmk2 changed the title Make hook dispatcher use absolute node_modules/.bin for subdirectory installs fix(cli): preserve hook PATH after directory changes Nov 16, 2026
@fengmk2 fengmk2 self-assigned this Nov 16, 2026
@fengmk2 fengmk2 added the preview-build Publish this PR's commits to the registry bridge as preview builds label Nov 17, 2026 — with ChatGPT Codex Connector
@github-actions

Copy link
Copy Markdown
Contributor

Preview binary sizes (af2e437)

Compared with the latest stable release, v1.6.0. Preview build.
Each row measures one binary. Negative changes mean a smaller preview binary.

Binary Latest release Preview Change
vp (macOS ARM64) 5.46 MiB 5.46 MiB +32 B (+0.00%)
NAPI (macOS ARM64) 43.39 MiB 43.61 MiB +226.23 KiB (+0.51%)
vp (macOS x64) 6.92 MiB 6.93 MiB +16.05 KiB (+0.23%)
NAPI (macOS x64) 48.76 MiB 49.00 MiB +245.23 KiB (+0.49%)
vp (Linux ARM64 GNU) 6.90 MiB 6.91 MiB +8.05 KiB (+0.11%)
NAPI (Linux ARM64 GNU) 32.68 MiB 32.91 MiB +236.02 KiB (+0.71%)
vp (Linux ARM64 musl) 6.97 MiB 6.99 MiB +10.73 KiB (+0.15%)
NAPI (Linux ARM64 musl) 31.89 MiB 32.13 MiB +248.52 KiB (+0.76%)
vp (Linux x64 GNU) 8.33 MiB 8.35 MiB +16.05 KiB (+0.19%)
NAPI (Linux x64 GNU) 36.69 MiB 36.98 MiB +292.00 KiB (+0.78%)
vp (Linux x64 musl) 8.41 MiB 8.42 MiB +8.81 KiB (+0.10%)
NAPI (Linux x64 musl) 35.90 MiB 36.18 MiB +290.47 KiB (+0.79%)
vp (Windows x64) 6.19 MiB 6.19 MiB 0 B (0.00%)
NAPI (Windows x64) 32.45 MiB 32.67 MiB +226.00 KiB (+0.68%)
Trampoline (Windows x64) 13.00 KiB 13.00 KiB 0 B (0.00%)
Installer (Windows x64) 4.69 MiB 4.69 MiB +5.00 KiB (+0.10%)
vp (Windows ARM64) 5.42 MiB 5.42 MiB +3.50 KiB (+0.06%)
NAPI (Windows ARM64) 28.66 MiB 28.85 MiB +202.00 KiB (+0.69%)
Trampoline (Windows ARM64) 13.00 KiB 13.00 KiB 0 B (0.00%)
Installer (Windows ARM64) 3.86 MiB 3.86 MiB +5.00 KiB (+0.13%)
gzip -9 sizes
Binary Latest release Preview Change
vp (macOS ARM64) 3.25 MiB 3.25 MiB +3.28 KiB (+0.10%)
NAPI (macOS ARM64) 18.85 MiB 18.93 MiB +82.35 KiB (+0.43%)
vp (macOS x64) 3.43 MiB 3.44 MiB +7.49 KiB (+0.21%)
NAPI (macOS x64) 20.12 MiB 20.22 MiB +101.75 KiB (+0.49%)
vp (Linux ARM64 GNU) 3.74 MiB 3.75 MiB +6.88 KiB (+0.18%)
NAPI (Linux ARM64 GNU) 13.93 MiB 14.02 MiB +85.95 KiB (+0.60%)
vp (Linux ARM64 musl) 3.77 MiB 3.77 MiB +6.57 KiB (+0.17%)
NAPI (Linux ARM64 musl) 13.64 MiB 13.72 MiB +81.78 KiB (+0.59%)
vp (Linux x64 GNU) 3.81 MiB 3.82 MiB +4.25 KiB (+0.11%)
NAPI (Linux x64 GNU) 14.65 MiB 14.75 MiB +103.33 KiB (+0.69%)
vp (Linux x64 musl) 3.84 MiB 3.84 MiB +2.97 KiB (+0.08%)
NAPI (Linux x64 musl) 14.33 MiB 14.43 MiB +96.43 KiB (+0.66%)
vp (Windows x64) 2.86 MiB 2.86 MiB -2.30 KiB (-0.08%)
NAPI (Windows x64) 13.31 MiB 13.39 MiB +83.26 KiB (+0.61%)
Trampoline (Windows x64) 7.14 KiB 7.14 KiB +1 B (+0.01%)
Installer (Windows x64) 2.25 MiB 2.25 MiB +1.98 KiB (+0.09%)
vp (Windows ARM64) 2.73 MiB 2.73 MiB +595 B (+0.02%)
NAPI (Windows ARM64) 12.62 MiB 12.70 MiB +78.88 KiB (+0.61%)
Trampoline (Windows ARM64) 6.93 KiB 6.93 KiB -1 B (-0.01%)
Installer (Windows ARM64) 2.14 MiB 2.14 MiB +3.29 KiB (+0.15%)

Raw sizes are uncompressed file sizes. gzip sizes recompress each binary at level 9; they are not package or download archive sizes.
The baseline uses published release files, including NAPI packages from npm at the same version. Build versions and toolchains can affect the difference.

@github-actions

Copy link
Copy Markdown
Contributor

Registry bridge build (af2e437)

This commit build is published to the registry bridge, which serves these as ordinary npm versions (every other package proxies to npmjs):

Package Version
vite-plus 0.0.0-commit.af2e437f2e2a3416d135d625e3ab11cd4532aa03
@voidzero-dev/vite-plus-core 0.0.0-commit.af2e437f2e2a3416d135d625e3ab11cd4532aa03
create-vite-plus 0.0.0-commit.af2e437f2e2a3416d135d625e3ab11cd4532aa03

Install the Vite+ CLI built from this commit, then migrate a project:

# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/voidzero-dev/vite-plus/af2e437f2e2a3416d135d625e3ab11cd4532aa03/packages/cli/install.sh | VP_PR_VERSION=3451 VP_LEGACY_INSTALLER_URL=https://raw.githubusercontent.com/voidzero-dev/vite-plus/af2e437f2e2a3416d135d625e3ab11cd4532aa03/packages/cli/install-legacy.sh bash
# Windows (PowerShell)
$env:VP_PR_VERSION="3451"; $env:VP_LEGACY_INSTALLER_URL="https://raw.githubusercontent.com/voidzero-dev/vite-plus/af2e437f2e2a3416d135d625e3ab11cd4532aa03/packages/cli/install-legacy.ps1"; irm https://raw.githubusercontent.com/voidzero-dev/vite-plus/af2e437f2e2a3416d135d625e3ab11cd4532aa03/packages/cli/install.ps1 | iex

Or install with Homebrew (macOS / glibc Linux):

These commands use the formula and binary from this published commit. Replace brew install with brew reinstall if the tap package is already installed.
If Homebrew Core’s vite-plus is installed, run brew uninstall vite-plus first. This keeps your user data; do not run vp implode to switch installations.

(
  set -eu
  export HOMEBREW_NO_AUTO_UPDATE=1
  export HOMEBREW_VP_PR_VERSION=af2e437f2e2a3416d135d625e3ab11cd4532aa03
  brew tap voidzero-dev/vite-plus https://github.com/voidzero-dev/vite-plus
  preview_tap="$(brew --repository voidzero-dev/vite-plus)"
  git -C "$preview_tap" fetch --depth=1 https://github.com/voidzero-dev/vite-plus.git "$HOMEBREW_VP_PR_VERSION"
  git -C "$preview_tap" switch --detach "$HOMEBREW_VP_PR_VERSION"
  brew install voidzero-dev/vite-plus/vp
  brew test voidzero-dev/vite-plus/vp
  "$(brew --prefix)/bin/vp"
)

The tap stays at the tested commit. Return it to main after testing:

git -C "$(brew --repository voidzero-dev/vite-plus)" switch main

Or download the standalone Windows installer built from this commit:

Architecture Installer
x64 vp-setup-x86_64-pc-windows-msvc.exe
Arm64 vp-setup-aarch64-pc-windows-msvc.exe

GitHub requires you to sign in and downloads each installer as a ZIP artifact. Extract vp-setup.exe, then run it against this preview build:

.\vp-setup.exe --version "0.0.0-commit.af2e437f2e2a3416d135d625e3ab11cd4532aa03" --registry "https://registry-bridge.viteplus.dev/"

After installing, upgrade the current project's vite-plus to this test build with:

vp migrate

Or create a new project from this commit without installing the CLI:

export npm_config_registry=https://registry-bridge.viteplus.dev/ pnpm_config_registry=https://registry-bridge.viteplus.dev/
pnpm create vite-plus@0.0.0-commit.af2e437f2e2a3416d135d625e3ab11cd4532aa03 # or: npm create vite-plus@0.0.0-commit.af2e437f2e2a3416d135d625e3ab11cd4532aa03
$env:npm_config_registry="https://registry-bridge.viteplus.dev/"; $env:pnpm_config_registry="https://registry-bridge.viteplus.dev/"
pnpm create vite-plus@0.0.0-commit.af2e437f2e2a3416d135d625e3ab11cd4532aa03 # or: npm create vite-plus@0.0.0-commit.af2e437f2e2a3416d135d625e3ab11cd4532aa03

pnpm 11+ reads pnpm_config_registry, npm and older pnpm read npm_config_registry. The new project pins this build, so keep the registry set for later installs, or configure it as below.

Or 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.af2e437f2e2a3416d135d625e3ab11cd4532aa03",
    "vite": "npm:@voidzero-dev/vite-plus-core@0.0.0-commit.af2e437f2e2a3416d135d625e3ab11cd4532aa03"
  }
}

@github-actions

Copy link
Copy Markdown
Contributor

🐳 Docker preview image

Built from this PR's registry bridge build:

Image Compressed size
ghcr.io/voidzero-dev/vite-plus:pr-3451 229MB
# remove any stale local copy from a previous run, then pull fresh
docker rmi ghcr.io/voidzero-dev/vite-plus:pr-3451 2>/dev/null; docker pull ghcr.io/voidzero-dev/vite-plus:pr-3451

Quick check:

docker run --rm ghcr.io/voidzero-dev/vite-plus:pr-3451 vp --version

See docs/guide/docker.md for usage.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix verified preview-build Publish this PR's commits to the registry bridge as preview builds

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hook dispatcher puts a relative node_modules/.bin on PATH when the hooks dir is in a subfolder, so hooks that cd fail with "vp: command not found"

1 participant