rules: R120 narrowed to reply drafts; commit helper check narrowed to match

This commit is contained in:
Drew T
2026-09-30 15:33:25 -06:00
parent ba807d1258
commit c4168ef1db
4 changed files with 16 additions and 15 deletions
+8 -6
View File
@@ -44,10 +44,12 @@ case "$MSG" in
"$TASK:"*|"$TASK "*) FULL="$MSG";;
*) FULL="$TASK: $MSG";;
esac
# R120: outward threads (issue/PR number or URL, or an `Outward: yes` line in a discussion record)
# are never named in a commit message and their discussion records are never committed.
OUTWARD='(github\.com/[^ ]*/(issues|pull)/[0-9]|\b(issue|PR|pull request) ?#?[0-9]+\b|^Outward: *yes)'
printf '%s' "$FULL" | grep -qiE "$OUTWARD" && refuse "message names an outward thread (R120)"
# R120: reply drafts to an issue/PR/reporter are never mentioned in a commit message, and
# reply-drafting discussion records (`Outward: yes`, or a reply/reporter topic) are never committed.
# A fix that cites an issue number or URL is fine.
REPLY='(\b(draft(ed|s)?|post(ed|s)?)\b.{0,40}\b(repl(y|ies)|comment|response)\b|\b(repl(y|ies)|response)\b.{0,40}\b(issue|PR|pull request|reporter)\b|\bissue[-_ ]?#?[0-9]*[-_ ]repl(y|ies)\b)'
OUTWARD="(^Outward: *yes|^# D[0-9]+ .*\b(repl(y|ies)|reporter)\b|$REPLY)"
printf '%s' "$FULL" | grep -qiE "$REPLY" && refuse "message mentions a drafted/posted reply (R120)"
ROOT="$(find_root)"
cd "$ROOT" || refuse "cannot cd to $ROOT"
@@ -106,11 +108,11 @@ for f in $(git diff --cached --name-only -- "$PE/current/logs" "$PE/current/task
fi
done
# R120: an outward-thread discussion record stays unstaged in the tree (see OUTWARD above).
# R120: a reply-drafting discussion record stays unstaged in the tree (see OUTWARD above).
for f in $(git diff --cached --name-only --diff-filter=AM -- "$PE/current/discussions"); do
if [ -f "$f" ] && grep -qiE "$OUTWARD" -- "$f"; then
git reset -q -- "$f" || refuse "git reset $f failed"
echo "left out: $f (outward-thread discussion record; R120 keeps it local)"
echo "left out: $f (reply-drafting discussion record; R120 keeps it local)"
fi
done