Hey, thanks for the report. Important note on “pre-commit”: Cursor doesn’t have a pre-commit event. Project hooks only trigger on supported events from the spec (afterFileEdit, beforeShellExecution, beforeReadFile, afterFileEdit, etc.), and they work in trusted workspaces. Documentation: Hooks | Cursor Docs
How to solve your pre-commit generation task:
- If data.json changes, attach the script run to afterFileEdit
- If the commit runs through the agent/terminal, intercept the git command in beforeShellExecution. Commits through the built-in SCM UI aren’t intercepted by hooks.
Could you please share:
- .cursor/hooks.json (full) and the contents of the called script
- Full log from View > Output > Cursor > Hooks at the time of reproduction (around the “Hook N produced no output” entry)
- Screenshot of Settings > Hooks and confirmation that the workspace is marked as Trusted
- Errors from Help > Toggle Developer Tools > Console (looking for spawn/ENOENT/EPERM/ExecutionPolicy)
Similar issue: [REGRESSION] Hook response fields user_message / agent_message still ignored in Windows v2.0.77 - they describe the current hooks problem on Windows.
Please provide this data and I’ll pass it to the team.