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/.
This commit is contained in:
14
.kiro/hooks/migration-registration-check.kiro.hook
Normal file
14
.kiro/hooks/migration-registration-check.kiro.hook
Normal file
@@ -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."
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user