Cursor · HooksSeguridad
Block git reset --hard
Stops the agent from discarding changes with git reset --hard.
by Prompt Studio
hooksbeforeShellExecution
License: MITView original
Contents
Where it goes: .cursor/hooks.json
{
"version": 1,
"hooks": {
"beforeShellExecution": [
{
"command": "bash -c 'jq -r .command | grep -Eiq -e \"git reset --hard\" && echo \"{\\\"permission\\\":\\\"deny\\\",\\\"userMessage\\\":\\\"Bloqueado por hooks.json: no se permite descartar cambios con git reset --hard\\\",\\\"agentMessage\\\":\\\"Bloqueado por hooks.json: no se permite descartar cambios con git reset --hard\\\"}\" || echo \"{\\\"permission\\\":\\\"allow\\\"}\"'"
}
]
}
}
More in Hooks
Block dangerous commands
Stops rm -rf, git push --force and similar before they run.
Protect .env
Prevents the agent from reading files with secrets.
Format on edit
Runs Prettier on every file the agent edits.
Lint on stop
Runs the linter when the agent finishes its turn.
Notify when done
Desktop notification when the agent finishes (macOS).
Command log
Saves every agent command to .cursor/audit.log.