Cursor · HooksPerfiles
Diff limpio
Sin TODO, console.log, debugger, .only ni marcas de conflicto.
por Prompt Studio
hooksstop
Licencia: MITVer original
Contenido
Dónde va: .cursor/hooks.json
{
"version": 1,
"hooks": {
"stop": [
{
"command": "bash -c 'jq -e \".status == \\\"completed\\\"\" >/dev/null || { echo \"{}\"; exit 0; }; if ! git diff -U0 | grep -E \"^[+].*(TODO|FIXME|XXX)\" >/tmp/cursor-hook-check.log 2>&1; then echo \"{}\"; else echo \"{\\\"followup_message\\\":\\\"Dejaste TODO o FIXME nuevos: resuélvelos o explícalos. Revisa /tmp/cursor-hook-check.log y corrígelo.\\\"}\"; fi'"
},
{
"command": "bash -c 'jq -e \".status == \\\"completed\\\"\" >/dev/null || { echo \"{}\"; exit 0; }; if ! git diff -U0 -- \"*.ts\" \"*.tsx\" \"*.js\" | grep -E \"^[+].*console[.]log\" >/tmp/cursor-hook-check.log 2>&1; then echo \"{}\"; else echo \"{\\\"followup_message\\\":\\\"Quedaron console.log nuevos: quítalos. Revisa /tmp/cursor-hook-check.log y corrígelo.\\\"}\"; fi'"
},
{
"command": "bash -c 'jq -e \".status == \\\"completed\\\"\" >/dev/null || { echo \"{}\"; exit 0; }; if ! git diff -U0 | grep -E \"^[+].*(debugger;|breakpoint[(][)]|binding[.]pry|byebug|dd[(])\" >/tmp/cursor-hook-check.log 2>&1; then echo \"{}\"; else echo \"{\\\"followup_message\\\":\\\"Quedaron llamadas de depuración: quítalas. Revisa /tmp/cursor-hook-check.log y corrígelo.\\\"}\"; fi'"
},
{
"command": "bash -c 'jq -e \".status == \\\"completed\\\"\" >/dev/null || { echo \"{}\"; exit 0; }; if ! git diff -U0 | grep -E \"^[+].*(it|test|describe)[.]only[(]\" >/tmp/cursor-hook-check.log 2>&1; then echo \"{}\"; else echo \"{\\\"followup_message\\\":\\\"Hay tests con .only: quítalo. Revisa /tmp/cursor-hook-check.log y corrígelo.\\\"}\"; fi'"
},
{
"command": "bash -c 'jq -e \".status == \\\"completed\\\"\" >/dev/null || { echo \"{}\"; exit 0; }; if ! git grep -nE \"^(<<<<<<<|>>>>>>>)\" >/tmp/cursor-hook-check.log 2>&1; then echo \"{}\"; else echo \"{\\\"followup_message\\\":\\\"Quedan marcas de conflicto de merge. Revisa /tmp/cursor-hook-check.log y corrígelo.\\\"}\"; fi'"
}
]
}
}
Más en Hooks
Bloquear comandos peligrosos
Detiene rm -rf, git push --force y similares antes de ejecutarse.
Proteger .env
Impide que el agente lea archivos con secretos.
Formatear al editar
Ejecuta Prettier en cada archivo que edita el agente.
Lint al terminar
Corre el linter cuando el agente termina su turno.
Aviso al terminar
Notificación de escritorio cuando el agente acaba (macOS).
Registro de comandos
Guarda cada comando del agente en .cursor/audit.log.