rules: R120 outward-thread hygiene; commit helper keeps such records local

This commit is contained in:
Drew T
2026-09-30 15:26:32 -06:00
parent 6dc49930b0
commit c0632d55fc
6 changed files with 30 additions and 15 deletions
+12
View File
@@ -44,6 +44,10 @@ 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)"
ROOT="$(find_root)"
cd "$ROOT" || refuse "cannot cd to $ROOT"
@@ -102,6 +106,14 @@ 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).
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)"
fi
done
if git diff --cached --quiet; then
refuse "nothing staged for $TASK"
fi