34 lines
1.3 KiB
Bash
Executable file
34 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
# Attribution guard: validate the effective author and committer identity
|
|
# git will actually record, not just .git/config. Resolves env vars →
|
|
# worktree config → global config in the same order git uses at commit
|
|
# time, so it catches every path: per-worktree `user.name`, exported
|
|
# GIT_AUTHOR_NAME / GIT_COMMITTER_NAME, and the legacy shared-clone
|
|
# approach. See docs/internal/MULTITENANT-AGENT-WORKFLOW.md.
|
|
AUTHOR_IDENT=$(git var GIT_AUTHOR_IDENT 2>/dev/null || true)
|
|
COMMITTER_IDENT=$(git var GIT_COMMITTER_IDENT 2>/dev/null || true)
|
|
# Strip " <email> timestamp tz" off each ident to get just the name.
|
|
AUTHOR_NAME=${AUTHOR_IDENT% <*}
|
|
COMMITTER_NAME=${COMMITTER_IDENT% <*}
|
|
|
|
guard_ident() {
|
|
role=$1
|
|
name=$2
|
|
case "$name" in
|
|
"Operator & "*|"Clawdie AI") ;;
|
|
*)
|
|
echo "pre-commit: $role name is '$name' — expected 'Operator & <agent>'." >&2
|
|
echo " Fix: use a per-agent worktree with" >&2
|
|
echo " git config --worktree user.name \"Operator & <agent>\"" >&2
|
|
echo " Or export GIT_AUTHOR_NAME and GIT_COMMITTER_NAME for this shell." >&2
|
|
echo " See docs/internal/MULTITENANT-AGENT-WORKFLOW.md." >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
guard_ident author "$AUTHOR_NAME"
|
|
guard_ident committer "$COMMITTER_NAME"
|
|
|
|
node scripts/update-readme-version.mjs
|
|
git add README.md
|