Loading...
Loading...
Cursor Cloud Agent 環境で Git hook 連鎖(特に commit-msg と Co-authored-by 付与・除去)を設計・実装・検証するときに参照する。Cursor 管理 hook の実行順、`commit-msg.cursor.co-author-strip` の命名規則、install スクリプト、lefthook 多層防御、テスト手順を定義する。
npx skill4agent add philtzjp/skills cursor-hook-authoringCo-authored-by:.git/hooks/<hook-name>.dispatchercommit-msg.cursor-original-hooks-path.git/hooks$HOOKS_DIR/$HOOK_NAME.cursor*commit-msg| 順序 | ファイル名 | 役割 |
|---|---|---|
| 1 | | シークレットスキャン(commit ブロック) |
| 2 | | |
| 3 | | |
commit-msg.cursor.co-author-stripcommit-msg.cursor.co-authorcommit-msg.cursor.strip-co-author.cursor/hooks/strip-co-authored-by.shcommit-msg.cursor.co-author-stripCo-authored-by:Co-Authored-By:.cursor/hooks/strip-co-authored-by.sh#!/usr/bin/env bash
set -euo pipefail
COMMIT_MSG_FILE="${1:?commit message file required}"
if [ ! -f "$COMMIT_MSG_FILE" ]; then
exit 0
fi
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT
awk '
BEGIN { skip_blank = 0 }
/^[Cc]o-[Aa]uthored-[Bb]y:/ { skip_blank = 1; next }
skip_blank && /^[[:space:]]*$/ { next }
{ skip_blank = 0; print }
' "$COMMIT_MSG_FILE" > "$tmp"
mv "$tmp" "$COMMIT_MSG_FILE"
trap - EXITscripts/install-cursor-agent-hooks.sh.git/hooksreadlink -f .git/hooks.git/hooks/.cursor-original-hooks-pathcommit-msg.cursor.co-author-strip$CURSOR_AGENT_HOOKS_DIRcommit-msgCo-authored-by:git-guard.shgit commit --no-verify--no-verifyCo-Authored-ByGIT_GUARD_ALLOW_FORCE_PUSH=1scripts/install-cursor-agent-hooks.shgit log -1 --format=%BCo-authored-by:Co-Authored-By:githubCo-Authored-Bylefthook run commit-msg --commit-msg-file /tmp/test-msggithubCo-Authored-Byskill-escalationrefresh-skills