Why: agents skipped triggered reading and wrote into shared checkouts holding other tasks' in-flight changes; the 2026-09-30 empty-list incident session found 24 overlapping in-flight files only by accident at first write. Evidence: positive/negative suite in a real scratch repo passed 19/19 (precheck READY/BUSY/SYNC_REQUIRED, start refuse/establish, hook main/badname/ longsubject refusals, sync checkpoint, finish recycle and abandon double- confirm); the suite caught three real defects (pipefail empty-grep abort, worktree gitdir COMMIT_EDITMSG resolution, message checks in the wrong hook phase). Impact: make setup enables pre-commit/commit-msg hooks; make precheck/task- start/task-sync/task-finish provide the governed path; no existing workflow removed. AGENTS.md carries the resident gate rules. Refs: Development-Guidelines 0.1.0-draft.7; task card .task/delivery-mechanism.md
14 lines
566 B
Bash
Executable File
14 lines
566 B
Bash
Executable File
#!/usr/bin/env bash
|
||
# 本地硬闸(pre-commit):集成分支直提拒绝 + 分支命名。权威准入在 PR(baseline.md:26)。
|
||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||
case "$branch" in
|
||
main|master)
|
||
echo "pre-commit: 拒绝——集成分支 ${branch} 不得直接提交,走 feature 分支 + PR(collaboration.md)" >&2
|
||
exit 1 ;;
|
||
esac
|
||
echo "$branch" | grep -qE '^(feature|fix|hotfix|release)/[A-Za-z0-9._-]+$' || {
|
||
echo "pre-commit: 拒绝——分支名须为 feature|fix|hotfix|release/<slug>,当前:${branch}" >&2
|
||
exit 1
|
||
}
|
||
exit 0
|