fix(cursor): validate native PowerShell hooks on Windows#651
Conversation
code-review-graph reviewOverall risk: 0.40 (MEDIUM) — 31 changed function(s)/class(es), 0 affected flow(s), 22 test gap(s) Risk-scored changes
Test gaps
Token savings: this graph-backed report used ~74,483 fewer tokens (~93%) than reading every changed file in full (estimated, chars/4 approximation). Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
0f5da3f to
02eb8d9
Compare
02eb8d9 to
36743ed
Compare
Co-authored-by: Mohammad Farahani <m.farahani@stts.ir>
36743ed to
8a24a02
Compare
rajpratham1
left a comment
There was a problem hiding this comment.
This pull request significantly improves Cursor integration on Windows by introducing native PowerShell hook support while preserving compatibility with existing Unix-based installations. The implementation cleanly separates platform-specific hook generation, correctly handles PowerShell command quoting, migrates existing CRG-managed Bash hooks without affecting unrelated user configuration, and extends uninstall logic to clean up both Unix and Windows hook artifacts across platform migrations. The accompanying test suite is comprehensive, covering configuration generation, migration scenarios, fail-open behavior, Windows command execution, uninstall behavior, and cross-platform compatibility. The implementation is cohesive, well-scoped, and no blocking issues were identified during review. LGTM and approved.
Latest refresh — 18 July 2026
Draft — do not merge until the released Cursor Windows-client checks below pass.
Change
This carries the safe Windows Cursor-hook work from source PR #617, with Mohammad Farahani preserved as co-author. It emits native PowerShell hooks on Windows, quotes paths containing spaces, migrates exact CRG-owned Bash or PowerShell entries without touching unrelated hooks, drains the full Cursor event, emits valid JSON, and fails open.
Why source PR #617 was closed
The source left the PowerShell
-Filepath unquoted, appended Windows entries beside stale Unix CRG entries, and asserted strings instead of executing the generated hooks on Windows. This draft fixes those gaps. Source PR #617 is closed as superseded.Automated validation
main(0a3bd6c); current head8a24a02git diff --check: cleanAutomated Windows CI covers paths with spaces, migration and reinstall, 2 MiB stdin events, missing and non-zero
code-review-graph, valid JSON output, exit code 0, and exact owned-hook cleanup.Required real-client validation
Do not mark this ready or merge it until all items below are recorded with a released Cursor client on Windows, using a home path containing spaces and an existing Unix-only CRG configuration plus an unrelated user hook:
afterFileEditinvokes the installed update hook without a hook-output or configuration errorsessionStartinvokes the installed status hook and Cursor accepts its JSON outputbeforeShellExecutioninvokes the installed pre-commit hook and Cursor accepts its JSON outputCarries PR #617 with original contributor attribution.