Skip to content

fix(windows): Suppress console windows for npx version hook execution#18

Merged
cpfiffer merged 2 commits intoletta-ai:mainfrom
scrossle:fix/windows-npx-console-suppression
Feb 9, 2026
Merged

fix(windows): Suppress console windows for npx version hook execution#18
cpfiffer merged 2 commits intoletta-ai:mainfrom
scrossle:fix/windows-npx-console-suppression

Conversation

@scrossle
Copy link
Contributor

@scrossle scrossle commented Feb 8, 2026

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 tsx without the windowsHide option, causing visible console windows to appear briefly on Windows.

Solution

Bundle a cross-platform wrapper script (hooks/silent-npx.js) that:

  • Detects the platform (process.platform === 'win32')
  • Sets windowsHide: true on Windows when spawning npx
  • Has no effect on Linux/macOS (option is ignored)

Affected Users

  • Primary: Windows users running npx version of Claude Code (especially ARM64)
  • Not affected: Users running native Claude Code binary (x64 Windows, macOS, Linux)

Testing

  • ✅ Tested on Windows ARM64 (Surface Laptop 7) - no console windows
  • ✅ Tested via WSL2 Debian - wrapper has no side effects
  • ✅ Cross-platform compatible (windowsHide ignored on non-Windows)

Changes

  1. Added hooks/silent-npx.js - Platform-aware wrapper script
  2. Updated hooks/hooks.json - All hook commands route through wrapper
  3. Bumped version to 1.3.1 (patch release for bug fix)
  4. No breaking changes - wrapper is transparent on non-Windows platforms

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)
@cpfiffer
Copy link
Collaborator

cpfiffer commented Feb 9, 2026

@letta-code seem reasonable?

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Letta Code encountered an error —— View job

Failed with exit code 128

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.
@cpfiffer cpfiffer merged commit 26d5951 into letta-ai:main Feb 9, 2026
@cpfiffer
Copy link
Collaborator

cpfiffer commented Feb 9, 2026

Thank you for your contribution!

@scrossle scrossle deleted the fix/windows-npx-console-suppression branch February 11, 2026 03:12
@scrossle scrossle restored the fix/windows-npx-console-suppression branch February 11, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants