Commits of agents carry a co-author trailer naming the model
A git wrapper (docker/git-coauthor -> /usr/local/lib/codecraft/bin/git) adds
--trailer "$CODECRAFT_COMMIT_TRAILER" right after the commit subcommand; the
agent shell puts it first on PATH and sets the trailer in the script itself
(works inside the sandbox, which clears the environment). Default text:
"Co-Authored-By: {model} ({provider}) via CodeCraft" (server.commit_trailer,
Settings -> General; empty = off). Git skips duplicates (amend, model wrote it).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1253430ed4
commit
9c80f2c857
9 files changed
+99
-1
No files matched your search
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# git for the shells of CodeCraft agents: `git commit` gets the co-author trailer from
|
||||
# $CODECRAFT_COMMIT_TRAILER (model, provider, CodeCraft). Everything else goes to the real
|
||||
# git unchanged. Git itself skips the trailer when the message already ends with it.
|
||||
real=${CODECRAFT_REAL_GIT:-/usr/bin/git}
|
||||
[[ -n $CODECRAFT_COMMIT_TRAILER ]] || exec "$real" "$@"
|
||||
# The subcommand comes after git's global options (-C dir, -c key=value, --git-dir=…).
|
||||
i=1
|
||||
while (( i <= $# )); do
|
||||
case ${!i} in
|
||||
-C | -c | --git-dir | --work-tree | --namespace | --exec-path | --config-env) i=$((i + 2)) ;;
|
||||
--) break ;;
|
||||
-*) i=$((i + 1)) ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
if (( i <= $# )) && [[ ${!i} == commit ]]; then
|
||||
# Right after "commit", so it stays an option even before "-- <paths>".
|
||||
exec "$real" "${@:1:i}" --trailer "$CODECRAFT_COMMIT_TRAILER" "${@:i+1}"
|
||||
fi
|
||||
exec "$real" "$@"
|
||||
Reference in new issue
Block a user