Wrap stop hook lgtm output

- Keep Stop hook stdout valid JSON so Codex can parse it.
- Move `./bin/brew lgtm` handling into a wrapper script.
This commit is contained in:
Mike McQuaid
2026-06-13 08:17:31 +01:00
parent 2b207ee276
commit 694e77e1c0
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
"hooks": [
{
"type": "command",
"command": "./bin/brew lgtm >&2 && printf '{\"continue\":true}'",
"command": ".codex/hooks/brew-lgtm-stop.sh",
"timeout": 360
}
]
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
cd "$(dirname "$0")/../.." || {
printf '%s\n' '{"decision":"block","reason":"Failed to cd to the repository root before running ./bin/brew lgtm."}'
exit 0
}
if ./bin/brew lgtm >&2
then
printf '%s\n' '{"continue":true}'
else
printf '%s\n' '{"decision":"block","reason":"./bin/brew lgtm failed; review the output above and fix it before stopping."}'
fi