From fd144966b7cf96ea9e4ec42cc4a0ed0051965628 Mon Sep 17 00:00:00 2001 From: Jordan Ramos Date: Fri, 22 May 2026 13:55:20 -0600 Subject: [PATCH] Strengthen migration registration hook to postToolUse/write The fileCreated hook was not reliably enforced. Switch to postToolUse on write operations so the check fires inline immediately after any file write, making it impossible to skip. The prompt self-filters to only act when the written file is in backend/migrations/. --- .kiro/hooks/migration-registration-check.kiro.hook | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .kiro/hooks/migration-registration-check.kiro.hook diff --git a/.kiro/hooks/migration-registration-check.kiro.hook b/.kiro/hooks/migration-registration-check.kiro.hook new file mode 100644 index 0000000..6f3afef --- /dev/null +++ b/.kiro/hooks/migration-registration-check.kiro.hook @@ -0,0 +1,14 @@ +{ + "enabled": true, + "name": "Migration Registration Check", + "description": "After any write to backend/migrations/, verify the file is registered in POSTGRES_MIGRATIONS array in run-all.js. Blocks until confirmed.", + "version": "2", + "when": { + "type": "postToolUse", + "toolTypes": ["write"] + }, + "then": { + "type": "askAgent", + "prompt": "STOP. If the tool just wrote or created a file matching backend/migrations/*.js (but NOT run-all.js itself), you MUST immediately:\n1. Read backend/migrations/run-all.js\n2. Check if the migration filename exists in the POSTGRES_MIGRATIONS array\n3. If NOT present, add it to the end of the array RIGHT NOW before doing anything else\n4. Do NOT proceed with other work until this is done\n\nThis is a hard requirement — migrations not in run-all.js will not run in CI/CD and will break production deploys. If the written file is not a migration file, ignore this message." + } +}