Skip to content

Windows: /cursor:setup fails with 'cursor-agent not found on PATH' — 'which' probe + un-spawnable .cmd shims #27

Description

@vilnis

Summary

On Windows, /cursor:setup always fails with cursor-agent not found on PATH even when the CLI is installed (native PowerShell installer) and works fine from a terminal.

Root cause (two layers)

  1. resolveBin() probes with which (scripts/lib/cursor.mjs) — which doesn't exist on Windows, so both candidates fail and the resolver throws.
  2. Even if the shim were found, it couldn't be spawned: the Windows install exposes cursor-agent only as .cmd / .ps1 shims (%LOCALAPPDATA%\cursor-agent\cursor-agent.{cmd,ps1}), and the plugin spawns without shell: true. Since Node's CVE-2024-27980 fix, spawn() of a .cmd/.bat without a shell fails with EINVAL. Pointing CURSOR_AGENT_BIN at the shim therefore doesn't help either.

Fix that works (tested locally)

The official cursor-agent.ps1 shim just locates the newest version directory and runs its bundled node: %LOCALAPPDATA%\cursor-agent\versions\<YYYY.MM.DD[-HH-MM-SS]-hash>\node.exe index.js. The plugin can do the same thing directly:

  • In resolveBin(), add a win32 branch that scans %LOCALAPPDATA%\cursor-agent\versions\, picks the newest dir (numeric date compare, same as the .ps1), and resolves to that node.exe, remembering [index.js] as prefix args.
  • Prepend those prefix args at each run(bin, …) / spawn(bin, …) call site (7 sites: runHeadless, authStatus, listModels ×2, listConfiguredMcps, listChats, and the --version check in setup.mjs).

With that patch applied to the cached plugin, /cursor:setup on Windows 11 goes fully green (binary found at versions\2026.08.11-e8db854\node.exe, login detected, jobs dir writable) and headless delegation works.

Happy to share the full diff if useful.

Environment: Windows 11 Home 10.0.26200, plugin 0.6.1 (7174bd0), cursor-agent 2026.08.11-e8db854, Node 24.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions