[2026-05-15] Discord 알림 - 이번 세션 신규 커밋만 전송

- SessionStart 훅: git HEAD를 session_start_sha.txt에 저장
- discord_notify.py: 세션 시작 이후 커밋만 표시 (누적 방지)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 13:59:30 +09:00
parent f4574ce6be
commit 9ea0a5101d
2 changed files with 24 additions and 1 deletions
+13 -1
View File
@@ -5,7 +5,17 @@ WEBHOOK = "https://discord.com/api/webhooks/1504705352166543370/H3dhs_4LaxnaFj_m
def run(cmd):
return subprocess.run(cmd, capture_output=True, text=True, encoding='utf-8', errors='replace').stdout.strip()
log = run(['git', 'log', '--oneline', '-5'])
import pathlib
SESSION_SHA_FILE = pathlib.Path('.claude/session_start_sha.txt')
# 세션 시작 시 저장된 HEAD와 비교해 이번 세션 커밋만 표시
start_sha = SESSION_SHA_FILE.read_text().strip() if SESSION_SHA_FILE.exists() else ''
if start_sha:
log = run(['git', 'log', '--oneline', f'{start_sha}..HEAD'])
else:
log = run(['git', 'log', '--oneline', '-5'])
status = run(['git', 'status', '--short'])
diff_stat = run(['git', 'diff', '--stat'])
now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M')
@@ -14,6 +24,8 @@ parts = [f"**[Claude Code 작업완료] {now}**"]
if log:
parts.append(f"```\n{log}\n```")
elif not status and not diff_stat:
parts.append("_이번 세션 변경사항 없음_")
if status or diff_stat:
combined = '\n'.join(filter(None, [status, diff_stat]))
+11
View File
@@ -2,6 +2,17 @@
"dangerouslySkipPermissions": true,
"instructions": "코드만 출력, 설명은 주석으로. 수정은 변경된 함수/diff 단위만. 답변 마지막에 1줄 요약. 상세 설명은 요청 시에만. 수정 후 반드시 git commit/push.",
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "git rev-parse HEAD > .claude/session_start_sha.txt 2>nul || echo > .claude/session_start_sha.txt",
"shell": "powershell"
}
]
}
],
"Stop": [
{
"hooks": [