fix(windows): Suppress console windows for npx version hook execution#18
Merged
cpfiffer merged 2 commits intoletta-ai:mainfrom Feb 9, 2026
Merged
Conversation
When using the npx version of Claude Code on Windows, visible console windows flash on screen every time a hook executes. This is particularly disruptive for users on ARM64 Windows devices where the native binary is not yet available. Solution: Bundle a cross-platform wrapper script that detects the platform and sets windowsHide: true on Windows when spawning npx. The wrapper has no effect on Linux/macOS. Affected users: - Primary: Windows users running npx version (especially ARM64) - Not affected: Native Claude Code binary users (x64, macOS, Linux) Testing: - Tested on Windows ARM64 (Surface Laptop 7) - no console windows - Tested via WSL2 Debian - no side effects - Cross-platform compatible (windowsHide ignored on non-Windows)
Collaborator
|
@letta-code seem reasonable? |
|
Letta Code encountered an error —— View job The agent encountered an issue before updating the comment. |
Without shell: true on Windows, spawn() doesn't resolve .cmd files automatically, which could cause npx to fail on some configurations.
Collaborator
|
Thank you for your contribution! |
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.
Problem
When using the npx version of Claude Code on Windows, visible console windows flash on screen every time a hook executes (SessionStart, UserPromptSubmit, PreToolUse, Stop). This is particularly disruptive for users on ARM64 Windows devices where the native binary is not yet available.
Root Cause
The hook scripts spawn Node.js processes via
npx tsxwithout thewindowsHideoption, causing visible console windows to appear briefly on Windows.Solution
Bundle a cross-platform wrapper script (
hooks/silent-npx.js) that:process.platform === 'win32')windowsHide: trueon Windows when spawningnpxAffected Users
Testing
Changes
hooks/silent-npx.js- Platform-aware wrapper scripthooks/hooks.json- All hook commands route through wrapper