Skip to content

feat(env): use trampoline exe instead of .cmd wrappers on Windows#981

Merged
fengmk2 merged 1 commit intomainfrom
trampoline-exe-for-shims
Mar 18, 2026
Merged

feat(env): use trampoline exe instead of .cmd wrappers on Windows#981
fengmk2 merged 1 commit intomainfrom
trampoline-exe-for-shims

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Mar 17, 2026

Summary

  • Replace Windows .cmd shim wrappers with lightweight trampoline .exe binaries
  • Eliminates the "Terminate batch job (Y/N)?" prompt on Ctrl+C
  • The trampoline detects its tool name from its own filename, sets VITE_PLUS_SHIM_TOOL env var, spawns vp.exe, ignores Ctrl+C (child handles it), and propagates the exit code
  • Thanks for the solution suggestion from @sunfkny

Changes

  • Add crates/vite_trampoline/ — minimal Windows trampoline binary (~100-150KB)
  • Update shim detection (detect_shim_tool) to check VITE_PLUS_SHIM_TOOL env var before argv[0]
  • Replace .cmd/.sh wrapper creation with trampoline .exe copying in setup.rs and global_install.rs
  • Add rename-before-copy pattern for refreshing bin/vp.exe while it's running
  • Add legacy .cmd/.sh cleanup during vp env setup --refresh
  • Update CI to build and distribute vp-shim.exe for Windows targets
  • Update install.ps1, install.sh, publish-native-addons.ts for trampoline distribution
  • Update extract_platform_package in upgrade path to also extract vp-shim.exe
  • Update npm-link conflict detection to recognize .exe shims
  • Add RFC document and update existing RFCs (env-command, upgrade-command, vpx-command)

Manual testing (Windows)

1. Fresh install via PowerShell

Remove-Item -Recurse -Force "$env:USERPROFILE\.vite-plus" -ErrorAction SilentlyContinue
& ./packages/cli/install.ps1
dir "$env:USERPROFILE\.vite-plus\bin\*.exe"
dir "$env:USERPROFILE\.vite-plus\bin\*.cmd"
  • Trampoline .exe shims created for vp, node, npm, npx, vpx
  • No legacy .cmd wrappers for core tools (only vp-use.cmd if present)
  • node --version works
  • npm --version works
  • vp --version works

2. Fresh install via Git Bash (install.sh)

rm -rf ~/.vite-plus
bash ./packages/cli/install.sh
ls -la ~/.vite-plus/current/bin/vp-shim.exe
  • vp-shim.exe copied alongside vp.exe in current/bin/
  • node --version works
  • npm --version works

3. Ctrl+C behavior (the main fix)

vp dev
# Press Ctrl+C in each shell
  • cmd.exe: clean exit, NO "Terminate batch job (Y/N)?" prompt
  • PowerShell: clean exit
  • Git Bash: clean exit

4. Exit code propagation

node -e "process.exit(42)"; echo $LASTEXITCODE
npm run nonexistent-script; echo $LASTEXITCODE
  • Exit code 42 propagated correctly
  • Non-zero exit code from failed npm command

5. Nested shim invocations (recursion marker)

npm --version
pnpm --version
  • npm --version prints version (npm spawns node internally)
  • pnpm --version prints version (pnpm spawns node internally)

6. vp env setup --refresh (running exe overwrite)

vp env setup --refresh
node --version
dir "$env:USERPROFILE\.vite-plus\bin\*.old"
  • Refresh succeeds without "sharing violation" error
  • Shims still work after refresh
  • .old files cleaned up (or only one recent if vp.exe was still running)

7. vp install -g / vp remove -g (managed package shims)

vp install -g typescript
where.exe tsc
tsc --version
vp remove -g typescript
dir "$env:USERPROFILE\.vite-plus\bin\tsc*"
  • tsc.exe created (NOT tsc.cmd)
  • tsc --version works
  • After remove: no tsc.exe, tsc.cmd, or extensionless tsc left behind

8. npm install -g auto-link (npm-managed packages)

npm install -g cowsay
where.exe cowsay
cowsay hello
npm uninstall -g cowsay
  • npm packages use .cmd wrapper (NOT trampoline)
  • cowsay works
  • Uninstall removes the .cmd wrapper

9. vp upgrade and rollback

vp --version
vp upgrade <version>
node --version
vp upgrade --rollback
vp --version
  • Upgrade succeeds, shims still work
  • Rollback succeeds, shims still work

10. Install a pre-trampoline version (downgrade compatibility)

$env:VITE_PLUS_VERSION = "<pre-trampoline-version>"
& ./packages/cli/install.ps1
Remove-Item Env:VITE_PLUS_VERSION
dir "$env:USERPROFILE\.vite-plus\bin\*.exe"
dir "$env:USERPROFILE\.vite-plus\bin\*.cmd"
  • Falls back to .cmd wrappers
  • Stale trampoline .exe shims removed (node.exe, npm.exe, etc.)
  • vp --version works via .cmd wrapper

11. vp env doctor

vp env doctor
  • Shows shims as working, no errors about missing files

12. Cross-shell verification

  • cmd.exe: node --version, npm --version, vp --version all work
  • PowerShell: node --version, npm --version, vp --version all work
  • Git Bash: node --version, npm --version, vp --version all work

Closes #835

@netlify
Copy link

netlify bot commented Mar 17, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit ae93e93
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69baa647c707f300089411c5

@fengmk2 fengmk2 self-assigned this Mar 17, 2026
Copy link
Member Author

fengmk2 commented Mar 17, 2026


How to use the Graphite Merge Queue

Add the label auto-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch 6 times, most recently from 6a57f80 to 880a128 Compare March 17, 2026 06:35
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch 4 times, most recently from 1d70634 to b68fc97 Compare March 17, 2026 08:30
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch 3 times, most recently from 21e0c54 to edc1dc3 Compare March 17, 2026 11:42
@fengmk2 fengmk2 marked this pull request as ready for review March 17, 2026 11:42
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch 7 times, most recently from ed71eb6 to 849c126 Compare March 17, 2026 13:06
@fengmk2
Copy link
Member Author

fengmk2 commented Mar 17, 2026

node.exe mode test was successful, the vitest extension can run now

Image

@fengmk2 fengmk2 added the test: e2e Auto run e2e tests label Mar 17, 2026
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch 4 times, most recently from cfccc29 to d64cba8 Compare March 18, 2026 07:42
@Brooooooklyn
Copy link
Member

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d64cba8cda

ℹ️ 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".

@Brooooooklyn
Copy link
Member

@cursor review

@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from df57cf4 to 5534094 Compare March 18, 2026 11:38
@graphite-app
Copy link

graphite-app bot commented Mar 18, 2026

Merge activity

  • Mar 18, 12:09 PM UTC: fengmk2 added this pull request to the Graphite merge queue.
  • Mar 18, 12:18 PM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'done', 'CLI E2E test (macos-latest)').

graphite-app bot pushed a commit that referenced this pull request Mar 18, 2026
## Summary

- Replace Windows `.cmd` shim wrappers with lightweight trampoline `.exe` binaries
- Eliminates the "Terminate batch job (Y/N)?" prompt on Ctrl+C
- The trampoline detects its tool name from its own filename, sets `VITE_PLUS_SHIM_TOOL` env var, spawns `vp.exe`, ignores Ctrl+C (child handles it), and propagates the exit code
- Thanks for the solution suggestion from @sunfkny

## Changes

- Add `crates/vite_trampoline/` — minimal Windows trampoline binary (~100-150KB)
- Update shim detection (`detect_shim_tool`) to check `VITE_PLUS_SHIM_TOOL` env var before `argv[0]`
- Replace `.cmd`/`.sh` wrapper creation with trampoline `.exe` copying in `setup.rs` and `global_install.rs`
- Add rename-before-copy pattern for refreshing `bin/vp.exe` while it's running
- Add legacy `.cmd`/`.sh` cleanup during `vp env setup --refresh`
- Update CI to build and distribute `vp-shim.exe` for Windows targets
- Update `install.ps1`, `install.sh`, `publish-native-addons.ts` for trampoline distribution
- Update `extract_platform_package` in upgrade path to also extract `vp-shim.exe`
- Update npm-link conflict detection to recognize `.exe` shims
- Add RFC document and update existing RFCs (`env-command`, `upgrade-command`, `vpx-command`)

## Manual testing (Windows)

### 1\. Fresh install via PowerShell

```powershell
Remove-Item -Recurse -Force "$env:USERPROFILE\.vite-plus" -ErrorAction SilentlyContinue
& ./packages/cli/install.ps1
dir "$env:USERPROFILE\.vite-plus\bin\*.exe"
dir "$env:USERPROFILE\.vite-plus\bin\*.cmd"
```

- [x] Trampoline `.exe` shims created for vp, node, npm, npx, vpx
- [x] No legacy `.cmd` wrappers for core tools (only `vp-use.cmd` if present)
- [x] `node --version` works
- [x] `npm --version` works
- [x] `vp --version` works

### 2\. Fresh install via Git Bash ([install.sh](http://install.sh))

```bash
rm -rf ~/.vite-plus
bash ./packages/cli/install.sh
ls -la ~/.vite-plus/current/bin/vp-shim.exe
```

- [x] `vp-shim.exe` copied alongside `vp.exe` in `current/bin/`
- [x] `node --version` works
- [x] `npm --version` works

### 3\. Ctrl+C behavior (the main fix)

```powershell
vp dev
# Press Ctrl+C in each shell
```

- [x] cmd.exe: clean exit, NO "Terminate batch job (Y/N)?" prompt
- [x] PowerShell: clean exit
- [x] Git Bash: clean exit

### 4\. Exit code propagation

```powershell
node -e "process.exit(42)"; echo $LASTEXITCODE
npm run nonexistent-script; echo $LASTEXITCODE
```

- [x] Exit code 42 propagated correctly
- [x] Non-zero exit code from failed npm command

### 5\. Nested shim invocations (recursion marker)

```powershell
npm --version
pnpm --version
```

- [x] `npm --version` prints version (npm spawns node internally)
- [x] `pnpm --version` prints version (pnpm spawns node internally)

### 6\. `vp env setup --refresh` (running exe overwrite)

```powershell
vp env setup --refresh
node --version
dir "$env:USERPROFILE\.vite-plus\bin\*.old"
```

- [x] Refresh succeeds without "sharing violation" error
- [x] Shims still work after refresh
- [x] `.old` files cleaned up (or only one recent if vp.exe was still running)

### 7\. `vp install -g` / `vp remove -g` (managed package shims)

```powershell
vp install -g typescript
where.exe tsc
tsc --version
vp remove -g typescript
dir "$env:USERPROFILE\.vite-plus\bin\tsc*"
```

- [x] `tsc.exe` created (NOT `tsc.cmd`)
- [x] `tsc --version` works
- [x] After remove: no `tsc.exe`, `tsc.cmd`, or extensionless `tsc` left behind

### 8\. `npm install -g` auto-link (npm-managed packages)

```powershell
npm install -g cowsay
where.exe cowsay
cowsay hello
npm uninstall -g cowsay
```

- [x] npm packages use `.cmd` wrapper (NOT trampoline)
- [x] `cowsay` works
- [x] Uninstall removes the `.cmd` wrapper

### 9\. `vp upgrade` and rollback

```powershell
vp --version
vp upgrade <version>
node --version
vp upgrade --rollback
vp --version
```

- [x] Upgrade succeeds, shims still work
- [x] Rollback succeeds, shims still work

### 10\. Install a pre-trampoline version (downgrade compatibility)

```powershell
$env:VITE_PLUS_VERSION = "<pre-trampoline-version>"
& ./packages/cli/install.ps1
Remove-Item Env:VITE_PLUS_VERSION
dir "$env:USERPROFILE\.vite-plus\bin\*.exe"
dir "$env:USERPROFILE\.vite-plus\bin\*.cmd"
```

- [x] Falls back to `.cmd` wrappers
- [x] Stale trampoline `.exe` shims removed (`node.exe`, `npm.exe`, etc.)
- [x] `vp --version` works via `.cmd` wrapper

### 11\. `vp env doctor`

```powershell
vp env doctor
```

- [x] Shows shims as working, no errors about missing files

### 12\. Cross-shell verification

- [x] cmd.exe: `node --version`, `npm --version`, `vp --version` all work
- [x] PowerShell: `node --version`, `npm --version`, `vp --version` all work
- [x] Git Bash: `node --version`, `npm --version`, `vp --version` all work

Closes #835
@graphite-app graphite-app bot force-pushed the trampoline-exe-for-shims branch from 04e854f to ffee013 Compare March 18, 2026 12:10
@fengmk2 fengmk2 changed the base branch from main to graphite-base/981 March 18, 2026 12:26
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from ffee013 to 641a5bc Compare March 18, 2026 12:26
@fengmk2 fengmk2 changed the base branch from graphite-base/981 to skip-flaky-snap-test March 18, 2026 12:26
@fengmk2 fengmk2 force-pushed the skip-flaky-snap-test branch from 65ba5ba to 0c90e9d Compare March 18, 2026 12:44
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from 641a5bc to 1b89385 Compare March 18, 2026 12:44
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from 1b89385 to 86fda74 Compare March 18, 2026 12:58
@fengmk2 fengmk2 force-pushed the skip-flaky-snap-test branch from 0c90e9d to 3135533 Compare March 18, 2026 12:58
@graphite-app graphite-app bot changed the base branch from skip-flaky-snap-test to graphite-base/981 March 18, 2026 13:07
graphite-app bot pushed a commit that referenced this pull request Mar 18, 2026
## Summary

- Replace Windows `.cmd` shim wrappers with lightweight trampoline `.exe` binaries
- Eliminates the "Terminate batch job (Y/N)?" prompt on Ctrl+C
- The trampoline detects its tool name from its own filename, sets `VITE_PLUS_SHIM_TOOL` env var, spawns `vp.exe`, ignores Ctrl+C (child handles it), and propagates the exit code
- Thanks for the solution suggestion from @sunfkny

## Changes

- Add `crates/vite_trampoline/` — minimal Windows trampoline binary (~100-150KB)
- Update shim detection (`detect_shim_tool`) to check `VITE_PLUS_SHIM_TOOL` env var before `argv[0]`
- Replace `.cmd`/`.sh` wrapper creation with trampoline `.exe` copying in `setup.rs` and `global_install.rs`
- Add rename-before-copy pattern for refreshing `bin/vp.exe` while it's running
- Add legacy `.cmd`/`.sh` cleanup during `vp env setup --refresh`
- Update CI to build and distribute `vp-shim.exe` for Windows targets
- Update `install.ps1`, `install.sh`, `publish-native-addons.ts` for trampoline distribution
- Update `extract_platform_package` in upgrade path to also extract `vp-shim.exe`
- Update npm-link conflict detection to recognize `.exe` shims
- Add RFC document and update existing RFCs (`env-command`, `upgrade-command`, `vpx-command`)

## Manual testing (Windows)

### 1\. Fresh install via PowerShell

```powershell
Remove-Item -Recurse -Force "$env:USERPROFILE\.vite-plus" -ErrorAction SilentlyContinue
& ./packages/cli/install.ps1
dir "$env:USERPROFILE\.vite-plus\bin\*.exe"
dir "$env:USERPROFILE\.vite-plus\bin\*.cmd"
```

- [x] Trampoline `.exe` shims created for vp, node, npm, npx, vpx
- [x] No legacy `.cmd` wrappers for core tools (only `vp-use.cmd` if present)
- [x] `node --version` works
- [x] `npm --version` works
- [x] `vp --version` works

### 2\. Fresh install via Git Bash ([install.sh](http://install.sh))

```bash
rm -rf ~/.vite-plus
bash ./packages/cli/install.sh
ls -la ~/.vite-plus/current/bin/vp-shim.exe
```

- [x] `vp-shim.exe` copied alongside `vp.exe` in `current/bin/`
- [x] `node --version` works
- [x] `npm --version` works

### 3\. Ctrl+C behavior (the main fix)

```powershell
vp dev
# Press Ctrl+C in each shell
```

- [x] cmd.exe: clean exit, NO "Terminate batch job (Y/N)?" prompt
- [x] PowerShell: clean exit
- [x] Git Bash: clean exit

### 4\. Exit code propagation

```powershell
node -e "process.exit(42)"; echo $LASTEXITCODE
npm run nonexistent-script; echo $LASTEXITCODE
```

- [x] Exit code 42 propagated correctly
- [x] Non-zero exit code from failed npm command

### 5\. Nested shim invocations (recursion marker)

```powershell
npm --version
pnpm --version
```

- [x] `npm --version` prints version (npm spawns node internally)
- [x] `pnpm --version` prints version (pnpm spawns node internally)

### 6\. `vp env setup --refresh` (running exe overwrite)

```powershell
vp env setup --refresh
node --version
dir "$env:USERPROFILE\.vite-plus\bin\*.old"
```

- [x] Refresh succeeds without "sharing violation" error
- [x] Shims still work after refresh
- [x] `.old` files cleaned up (or only one recent if vp.exe was still running)

### 7\. `vp install -g` / `vp remove -g` (managed package shims)

```powershell
vp install -g typescript
where.exe tsc
tsc --version
vp remove -g typescript
dir "$env:USERPROFILE\.vite-plus\bin\tsc*"
```

- [x] `tsc.exe` created (NOT `tsc.cmd`)
- [x] `tsc --version` works
- [x] After remove: no `tsc.exe`, `tsc.cmd`, or extensionless `tsc` left behind

### 8\. `npm install -g` auto-link (npm-managed packages)

```powershell
npm install -g cowsay
where.exe cowsay
cowsay hello
npm uninstall -g cowsay
```

- [x] npm packages use `.cmd` wrapper (NOT trampoline)
- [x] `cowsay` works
- [x] Uninstall removes the `.cmd` wrapper

### 9\. `vp upgrade` and rollback

```powershell
vp --version
vp upgrade <version>
node --version
vp upgrade --rollback
vp --version
```

- [x] Upgrade succeeds, shims still work
- [x] Rollback succeeds, shims still work

### 10\. Install a pre-trampoline version (downgrade compatibility)

```powershell
$env:VITE_PLUS_VERSION = "<pre-trampoline-version>"
& ./packages/cli/install.ps1
Remove-Item Env:VITE_PLUS_VERSION
dir "$env:USERPROFILE\.vite-plus\bin\*.exe"
dir "$env:USERPROFILE\.vite-plus\bin\*.cmd"
```

- [x] Falls back to `.cmd` wrappers
- [x] Stale trampoline `.exe` shims removed (`node.exe`, `npm.exe`, etc.)
- [x] `vp --version` works via `.cmd` wrapper

### 11\. `vp env doctor`

```powershell
vp env doctor
```

- [x] Shows shims as working, no errors about missing files

### 12\. Cross-shell verification

- [x] cmd.exe: `node --version`, `npm --version`, `vp --version` all work
- [x] PowerShell: `node --version`, `npm --version`, `vp --version` all work
- [x] Git Bash: `node --version`, `npm --version`, `vp --version` all work

Closes #835
@graphite-app graphite-app bot force-pushed the graphite-base/981 branch from 3135533 to 2f51312 Compare March 18, 2026 13:18
@graphite-app graphite-app bot force-pushed the trampoline-exe-for-shims branch from 86fda74 to d63d0df Compare March 18, 2026 13:18
@graphite-app graphite-app bot changed the base branch from graphite-base/981 to main March 18, 2026 13:18
## Summary

- Replace Windows `.cmd` shim wrappers with lightweight trampoline `.exe` binaries
- Eliminates the "Terminate batch job (Y/N)?" prompt on Ctrl+C
- The trampoline detects its tool name from its own filename, sets `VITE_PLUS_SHIM_TOOL` env var, spawns `vp.exe`, ignores Ctrl+C (child handles it), and propagates the exit code
- Thanks for the solution suggestion from @sunfkny

## Changes

- Add `crates/vite_trampoline/` — minimal Windows trampoline binary (~100-150KB)
- Update shim detection (`detect_shim_tool`) to check `VITE_PLUS_SHIM_TOOL` env var before `argv[0]`
- Replace `.cmd`/`.sh` wrapper creation with trampoline `.exe` copying in `setup.rs` and `global_install.rs`
- Add rename-before-copy pattern for refreshing `bin/vp.exe` while it's running
- Add legacy `.cmd`/`.sh` cleanup during `vp env setup --refresh`
- Update CI to build and distribute `vp-shim.exe` for Windows targets
- Update `install.ps1`, `install.sh`, `publish-native-addons.ts` for trampoline distribution
- Update `extract_platform_package` in upgrade path to also extract `vp-shim.exe`
- Update npm-link conflict detection to recognize `.exe` shims
- Add RFC document and update existing RFCs (`env-command`, `upgrade-command`, `vpx-command`)

## Manual testing (Windows)

### 1\. Fresh install via PowerShell

```powershell
Remove-Item -Recurse -Force "$env:USERPROFILE\.vite-plus" -ErrorAction SilentlyContinue
& ./packages/cli/install.ps1
dir "$env:USERPROFILE\.vite-plus\bin\*.exe"
dir "$env:USERPROFILE\.vite-plus\bin\*.cmd"
```

- [x] Trampoline `.exe` shims created for vp, node, npm, npx, vpx
- [x] No legacy `.cmd` wrappers for core tools (only `vp-use.cmd` if present)
- [x] `node --version` works
- [x] `npm --version` works
- [x] `vp --version` works

### 2\. Fresh install via Git Bash ([install.sh](http://install.sh))

```bash
rm -rf ~/.vite-plus
bash ./packages/cli/install.sh
ls -la ~/.vite-plus/current/bin/vp-shim.exe
```

- [x] `vp-shim.exe` copied alongside `vp.exe` in `current/bin/`
- [x] `node --version` works
- [x] `npm --version` works

### 3\. Ctrl+C behavior (the main fix)

```powershell
vp dev
# Press Ctrl+C in each shell
```

- [x] cmd.exe: clean exit, NO "Terminate batch job (Y/N)?" prompt
- [x] PowerShell: clean exit
- [x] Git Bash: clean exit

### 4\. Exit code propagation

```powershell
node -e "process.exit(42)"; echo $LASTEXITCODE
npm run nonexistent-script; echo $LASTEXITCODE
```

- [x] Exit code 42 propagated correctly
- [x] Non-zero exit code from failed npm command

### 5\. Nested shim invocations (recursion marker)

```powershell
npm --version
pnpm --version
```

- [x] `npm --version` prints version (npm spawns node internally)
- [x] `pnpm --version` prints version (pnpm spawns node internally)

### 6\. `vp env setup --refresh` (running exe overwrite)

```powershell
vp env setup --refresh
node --version
dir "$env:USERPROFILE\.vite-plus\bin\*.old"
```

- [x] Refresh succeeds without "sharing violation" error
- [x] Shims still work after refresh
- [x] `.old` files cleaned up (or only one recent if vp.exe was still running)

### 7\. `vp install -g` / `vp remove -g` (managed package shims)

```powershell
vp install -g typescript
where.exe tsc
tsc --version
vp remove -g typescript
dir "$env:USERPROFILE\.vite-plus\bin\tsc*"
```

- [x] `tsc.exe` created (NOT `tsc.cmd`)
- [x] `tsc --version` works
- [x] After remove: no `tsc.exe`, `tsc.cmd`, or extensionless `tsc` left behind

### 8\. `npm install -g` auto-link (npm-managed packages)

```powershell
npm install -g cowsay
where.exe cowsay
cowsay hello
npm uninstall -g cowsay
```

- [x] npm packages use `.cmd` wrapper (NOT trampoline)
- [x] `cowsay` works
- [x] Uninstall removes the `.cmd` wrapper

### 9\. `vp upgrade` and rollback

```powershell
vp --version
vp upgrade <version>
node --version
vp upgrade --rollback
vp --version
```

- [x] Upgrade succeeds, shims still work
- [x] Rollback succeeds, shims still work

### 10\. Install a pre-trampoline version (downgrade compatibility)

```powershell
$env:VITE_PLUS_VERSION = "<pre-trampoline-version>"
& ./packages/cli/install.ps1
Remove-Item Env:VITE_PLUS_VERSION
dir "$env:USERPROFILE\.vite-plus\bin\*.exe"
dir "$env:USERPROFILE\.vite-plus\bin\*.cmd"
```

- [x] Falls back to `.cmd` wrappers
- [x] Stale trampoline `.exe` shims removed (`node.exe`, `npm.exe`, etc.)
- [x] `vp --version` works via `.cmd` wrapper

### 11\. `vp env doctor`

```powershell
vp env doctor
```

- [x] Shows shims as working, no errors about missing files

### 12\. Cross-shell verification

- [x] cmd.exe: `node --version`, `npm --version`, `vp --version` all work
- [x] PowerShell: `node --version`, `npm --version`, `vp --version` all work
- [x] Git Bash: `node --version`, `npm --version`, `vp --version` all work

Closes #835
@graphite-app graphite-app bot force-pushed the trampoline-exe-for-shims branch from d63d0df to ae93e93 Compare March 18, 2026 13:19
@fengmk2 fengmk2 merged commit fb7cc34 into main Mar 18, 2026
50 of 51 checks passed
@fengmk2 fengmk2 deleted the trampoline-exe-for-shims branch March 18, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test: e2e Auto run e2e tests test: install-e2e run vite install e2e test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider using a Windows trampoline .exe instead of a .cmd wrapper to avoid Terminate batch job (Y/N)?

3 participants