Files
tradesdontlieandClaude Fable 5 e2ef51ed15 Make MSIX launch work on all Windows machines: local-copy CDP fallback
Detection was fixed in #52/#316, but issues #42, #75, and #128 show a
second failure class: on some Windows builds the MSIX package can't be
spawned from WindowsApps (EACCES), and even COM activation passes
--remote-debugging-port without the port ever binding. The
community-verified workaround (three independent confirmations in #128)
is to run the same files from a plain directory outside WindowsApps.

launch() now tries the direct WindowsApps spawn first; if the spawn
fails early or CDP doesn't bind within 15s, it copies the package to
%LOCALAPPDATA%\tradingview-mcp\<package> (once per version, stale
versions pruned) and relaunches from the copy. Verified on a real MSIX
install (TradingView 3.1.0, Electron 38): the copied instance keeps the
user's login, layout, and chart state, and CDP binds normally.

Also:
- Use 127.0.0.1 instead of localhost for all CDP traffic: on some
  Windows machines localhost resolves to ::1 first, which Electron's
  debug server doesn't listen on (surfaced by PR #237).
- launch_tv_debug.bat: replace timeout /t with ping -n (timeout aborts
  under redirected stdin), cap the CDP wait loop at 30 tries with a
  pointer to the tv_launch fallback, and probe 127.0.0.1.
- Add DI to launch() and tests/launch.test.js covering direct launch,
  EACCES fallback, no-bind fallback, copy reuse, and classic installs.
- Wire sanitization, replay, and launch tests into test:unit/test:all
  (they existed but never ran).

Fixes #42, #75, #99, #122, #128, #203, #23, #14.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 17:52:48 -04:00
..