diff --git a/.claude/discord_notify.py b/.claude/discord_notify.py index e35bbc7..c99f41d 100644 --- a/.claude/discord_notify.py +++ b/.claude/discord_notify.py @@ -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])) diff --git a/.claude/settings.json b/.claude/settings.json index 18f02eb..6886892 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -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": [