From be035403d40fb49cdd720fde84a4da16714edd09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EC=9E=AC=EC=A4=91?= <126754298+m-a-king@users.noreply.github.com> Date: Fri, 10 Jul 2026 03:59:24 +0900 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20commit-msg=20=ED=9B=85=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B8=EC=9D=84=20PIKI-Infra=20=EB=A1=9C=20=EC=9D=B4?= =?UTF-8?q?=EA=B4=80=20-=20=EC=B2=B4=ED=81=AC=EC=9D=B8=20=EB=B3=B5?= =?UTF-8?q?=EC=82=AC=EB=B3=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 훅 정본(SSOT)이 PIKI-Infra hooks/commit-msg 로 이동함에 따라, 이 repo 의 체크인 복사본(.claude/hooks/commit-msg)은 정본과 어긋날 수 있는 잔재라 삭제 - SessionStart 배선을 로컬 cp 에서 원격 fetch(gh api raw)로 교체. 설치 경로를 .git/hooks 직접 참조 대신 git rev-parse --git-common-dir 로 풀어 worktree(.git 이 파일)에서도 동작하게 정정. fetch 실패 시 기존 설치본 유지라 오프라인 안전 - commit.md 의 허용 타입 열거를 정본 참조로 교체 - 목록을 여기 두면 훅과 두 곳이 되어 한쪽만 바뀌는 drift 가 가능했음. 현재 타입은 설치된 훅을 읽어 확인 - 배선 검증 실측: 새 명령 exit 0, 설치본이 정본과 바이트 동일 --- .claude/commands/commit.md | 12 +----------- .claude/hooks/commit-msg | 5 ----- .claude/settings.json | 2 +- 3 files changed, 2 insertions(+), 17 deletions(-) delete mode 100755 .claude/hooks/commit-msg diff --git a/.claude/commands/commit.md b/.claude/commands/commit.md index c6aa22c8..d6411c49 100644 --- a/.claude/commands/commit.md +++ b/.claude/commands/commit.md @@ -39,17 +39,7 @@ refactor: DB schema squash 와 테이블명 복수형 통일 ## 허용 타입 -commit-msg 훅이 강제하는 목록과 1:1 이다. 훅의 **소스는 리포에 체크인된 `.claude/hooks/commit-msg`** 이고, SessionStart 훅(`.claude/settings.json`)이 세션 시작마다 이를 `.git/hooks/commit-msg` 로 복사한다. 바꿀 땐 `.git/hooks/` 사본이 아니라 소스를 고치고 이 목록도 함께 갱신한다 — 사본을 직접 수정하면 다음 세션 시작에 조용히 되돌려지고 다른 clone 에 전파되지도 않는다. - -- `feat:` — 새 기능 -- `fix:` — 버그 수정 -- `refactor:` — 동작 변경 없는 리팩토링 -- `perf:` — 성능 개선 -- `chore:` — 빌드, 설정 등 기타 -- `docs:` — 문서 변경 -- `test:` — 테스트 추가/수정 -- `infra:` — 인프라 (Terraform·AWS·배포 워크플로우·서버 설정) -- `style:` — 코드 포맷, 세미콜론 등 로직 변경 없는 스타일 +commit-msg 훅이 기계 강제한다. 훅의 **정본(SSOT)은 PIKI-Infra repo 의 `hooks/commit-msg`** 이고, SessionStart 훅(`.claude/settings.json`)이 세션 시작마다 원격 정본을 받아 `.git/hooks/commit-msg` 로 설치한다. 이 문서는 타입 목록을 열거하지 않는다 — 열거하면 정본과 두 곳이 되어 어긋난다. **현재 허용 타입은 설치된 훅(`.git/hooks/commit-msg`)을 읽어 확인**하고, 바꿀 땐 PIKI-Infra 정본을 고친다 (설치본·이 문서가 아니라). ## 커밋 분리 원칙 diff --git a/.claude/hooks/commit-msg b/.claude/hooks/commit-msg deleted file mode 100755 index 047ca644..00000000 --- a/.claude/hooks/commit-msg +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -msg=$(head -1 "$1") -echo "$msg" | grep -qE '^(feat|fix|refactor|perf|chore|docs|test|infra|style): .+' && exit 0 -echo "커밋 형식 오류: {feat|fix|refactor|perf|chore|docs|test|infra|style}: <제목>" >&2 -exit 1 diff --git a/.claude/settings.json b/.claude/settings.json index e2f35660..9dcd3de6 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -9,7 +9,7 @@ "hooks": [ { "type": "command", - "command": "[ -f .claude/hooks/commit-msg ] && cp .claude/hooks/commit-msg .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg || true" + "command": "bash -c 'tmp=$(mktemp); if gh api -H \"Accept: application/vnd.github.raw\" repos/TeamPiKi/PIKI-Infra/contents/hooks/commit-msg >\"$tmp\" 2>/dev/null && [ -s \"$tmp\" ]; then install -m 755 \"$tmp\" \"$(git rev-parse --git-common-dir)/hooks/commit-msg\"; fi; rm -f \"$tmp\"; exit 0'" } ] } From 60ad584655d5c8b5e4482de3525ea3d974bae414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EC=9E=AC=EC=A4=91?= <126754298+m-a-king@users.noreply.github.com> Date: Fri, 10 Jul 2026 04:06:46 +0900 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20=EB=B0=B0=EC=84=A0=EC=9D=84=20?= =?UTF-8?q?=EC=96=87=EC=9D=80=20=EB=B6=80=ED=8A=B8=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=9E=A9=20+=20PIKI-Infra=20install.sh=20=EB=A1=9C=20=EA=B5=90?= =?UTF-8?q?=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 직전 배선은 자산 경로·설치 로직이 SessionStart 명령에 문장째 박혀, 자산이 늘면 소비 repo 전부를 다시 고쳐야 했다 - 부트스트랩은 'PIKI-Infra install.sh 를 받아 실행' 한 줄로 축소. 이 repo 에 남는 상수는 repo 좌표 1개 - 검증 실측: 설치본 제거 후 부트스트랩 실행으로 원격 정본 설치(바이트 동일) --- .claude/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.claude/settings.json b/.claude/settings.json index 9dcd3de6..ae6bdd0f 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -9,7 +9,7 @@ "hooks": [ { "type": "command", - "command": "bash -c 'tmp=$(mktemp); if gh api -H \"Accept: application/vnd.github.raw\" repos/TeamPiKi/PIKI-Infra/contents/hooks/commit-msg >\"$tmp\" 2>/dev/null && [ -s \"$tmp\" ]; then install -m 755 \"$tmp\" \"$(git rev-parse --git-common-dir)/hooks/commit-msg\"; fi; rm -f \"$tmp\"; exit 0'" + "command": "bash -c 'gh api -H \"Accept: application/vnd.github.raw\" repos/TeamPiKi/PIKI-Infra/contents/install.sh 2>/dev/null | bash; exit 0'" } ] } From 82636af7809f21405c68a7871fc9c1929c7213cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EC=9E=AC=EC=A4=91?= <126754298+m-a-king@users.noreply.github.com> Date: Fri, 10 Jul 2026 04:30:05 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=EB=B6=80=ED=8A=B8=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=9E=A9=EC=9D=84=20=ED=8C=8C=EC=9D=B4=ED=94=84=20=EC=8B=A4?= =?UTF-8?q?=ED=96=89=EC=97=90=EC=84=9C=20=EB=AC=B8=EB=B2=95=20=EA=B2=80?= =?UTF-8?q?=EC=A6=9D=20=ED=9B=84=20=EC=8B=A4=ED=96=89=EC=9C=BC=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CodeRabbit 가용성 지적 수용분: install.sh 를 파이프로 바로 실행하면 문법 깨진 정본이 부분 실행될 수 있음. tmp 로 받아 bash -n 통과 시에만 실행 (실패 시 조용히 스킵, exit 0) - 검증 로직은 자산과 무관하게 안정적이라 '자산 추가 시 소비 repo 무변경' 속성은 유지 - SHA pin·체크섬 제안은 기각 (배선의 존재 이유인 무전파 갱신 파괴 + 동일 신뢰 도메인) - 사유는 PR thread reply 에 --- .claude/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.claude/settings.json b/.claude/settings.json index ae6bdd0f..ca96cc7f 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -9,7 +9,7 @@ "hooks": [ { "type": "command", - "command": "bash -c 'gh api -H \"Accept: application/vnd.github.raw\" repos/TeamPiKi/PIKI-Infra/contents/install.sh 2>/dev/null | bash; exit 0'" + "command": "bash -c 'tmp=$(mktemp); if gh api -H \"Accept: application/vnd.github.raw\" repos/TeamPiKi/PIKI-Infra/contents/install.sh >\"$tmp\" 2>/dev/null && [ -s \"$tmp\" ] && bash -n \"$tmp\" 2>/dev/null; then bash \"$tmp\"; fi; rm -f \"$tmp\"; exit 0'" } ] }