fix(hooks): private code-limits state dir, bounded session start without timeout, pre-commit fails closed

code-limits: mkdir -m 700 without -p as the atomic proof, else one
find test (ours, dir, 700). session-start: one runner, timeout then
gtimeout then perl alarm (exec, no shell). pre-commit (generator +
both copies): a git diff or grep error blocks. memory.sh line rewrap;
claude-stub reads its log path from the env. Tests T16, SD19, PC1-4.
This commit is contained in:
bchanot committed 2026-11-13 18:25:33 +01:00
1 parent 27946d5280
commit 1f107c3c45
10 files changed
+159 -27

No files matched your search

+11 -3
View File
@@ -489,9 +489,17 @@ esac
# .githooks/ (memory/doc/deploy helpers, the hooks themselves) — allow. Rules,
# settings, agents, skills stay blocked. --no-renames lists a rename's source
# too, so a git mv out of a blocked path cannot hide.
if [ -z "\$(git diff --cached --name-only --no-renames | grep -vE '^(\.claude/(memory|tasks|audits|deploy)|\.githooks)/' | head -1)" ]; then
exit 0
fi
staged=\$(git diff --cached --name-only --no-renames) || {
echo "gitflow pre-commit: cannot list staged paths: BLOCKED" >&2
exit 1
}
[ -n "\$staged" ] || exit 0
printf '%s\\n' "\$staged" | grep -qvE '^(\.claude/(memory|tasks|audits|deploy)|\.githooks)/'
case \$? in
0) ;;
1) exit 0 ;;
*) echo "gitflow pre-commit: cannot filter staged paths: BLOCKED" >&2; exit 1 ;;
esac
echo "gitflow pre-commit: BLOCKED — direct commit on '\$br'." >&2
echo " Branch from the right base (feature/bugfix->develop, hotfix->main), or merge." >&2