Add the task-startup gate scripts and local hooks

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
This commit is contained in:
weichen
2026-09-30 03:11:58 +00:00
parent 8349c633b0
commit f31fd5f62d
6 changed files with 230 additions and 5 deletions
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# 本地硬闸(commit-msg):主题行宽度/句点。git 将消息文件作为 $1 传入——
# 注意不能用 pre-commit 做此事:-m 消息在 prepare-commit-msg 才写入,pre-commit 阶段尚不存在。
msgfile="$1"
[ -n "$msgfile" ] && [ -f "$msgfile" ] || exit 0
subject=$(head -1 "$msgfile")
[ -n "$subject" ] || exit 0
w=$(python3 -c 'import sys,unicodedata;print(sum(2 if unicodedata.east_asian_width(c) in "WF" else 1 for c in sys.argv[1]))' "$subject")
[ "$w" -le 100 ] || { echo "commit-msg: 拒绝——主题行宽 ${w} > 100 列:${subject}" >&2; exit 1; }
case "$subject" in
*.) echo "commit-msg: 拒绝——主题行不以句点结尾:${subject}" >&2; exit 1 ;;
esac
exit 0