Skip to content

refactor: centralize repository hook implementations - #30

Merged
pko89403 merged 3 commits into
mainfrom
codex/git-hook-refactor
Apr 21, 2026
Merged

refactor: centralize repository hook implementations#30
pko89403 merged 3 commits into
mainfrom
codex/git-hook-refactor

Conversation

@pko89403

Copy link
Copy Markdown
Owner

한 줄 요약

  • 이 PR은 repository hook 구현을 scripts/hooks/로 통합하고 기존 진입점은 wrapper로 유지하도록 바꿉니다.

배경 / 문제

  • 기존 상태:
    • git hook 구현은 scripts/git-hooks/, Claude/Codex hook 구현은 .harness/hooks/에 흩어져 있었습니다.
    • 이 저장소는 bare-worktree 환경이라 단순 git 호출이 깨질 수 있는 특이점이 있습니다.
  • 문제:
    • 구현 위치가 분산되어 유지보수와 문서 동기화가 어려웠습니다.
    • 동일한 repo-root/git-context fallback 로직이 여러 hook에 중복되었습니다.
  • 이번 PR의 목표:
    • canonical hook 구현을 scripts/hooks/로 모으기
    • .githooks/, scripts/git-hooks/, .harness/hooks/는 stable entrypoint wrapper로 유지하기
    • bare-worktree fallback을 공용 helper로 표준화하기

PR 대시보드

항목 내용
유형 refactor
영향 범위 harness / tests
동작 변경 있음
Breaking Change 없음
관련 이슈 #
기준 브랜치 main

변경 묶음별 리뷰 가이드

변경 묶음 파일/디렉토리 무엇이 바뀌었나 리뷰 포인트 실행 없이 보는 법
핵심 로직 scripts/hooks/ canonical hook 구현을 신규 추가하고 common.sh로 git context fallback을 공유 bare-worktree fallback, wrapper 대상별 책임 분리 각 스크립트가 common.sh를 어떻게 쓰는지 보기
CLI / 엔트리포인트 .githooks/, scripts/git-hooks/, .harness/hooks/ 기존 경로는 wrapper만 남기고 canonical 구현으로 위임 기존 호출 경로 호환성 유지 여부 wrapper가 scripts/hooks/*.sh만 호출하는지 보기
문서 / 하네스 .harness/README.md canonical hook 위치와 wrapper 역할 설명 추가 구현과 설명 일치 여부 경로/용어 비교
테스트 tests/test_git_hook_scripts.py, tests/test_graphify_auto_refresh.py, tests/test_hook_runtime_layout.py hook layout과 auto-refresh runtime copy 경로를 검증 wrapper delegation과 runtime fixture completeness 테스트 이름과 assertion만 읽기

Before / After

Before

  • hook 구현이 scripts/git-hooks/.harness/hooks/로 나뉘어 있었습니다.
  • Claude safety hook과 graphify hook의 공통 git-context 처리가 분산돼 있었습니다.
  • bare-worktree 환경 대응이 hook별로 일관되지 않았습니다.

After

  • canonical 구현은 scripts/hooks/ 하나로 통합되었습니다.
  • .githooks/, scripts/git-hooks/, .harness/hooks/는 stable wrapper entrypoint로 유지됩니다.
  • scripts/hooks/common.sh가 repo-root 및 git worktree fallback을 공용으로 처리합니다.

검증

항목 결과 근거
테스트 uv run pytest tests/test_git_hook_scripts.py tests/test_graphify_auto_refresh.py tests/test_hook_runtime_layout.py
린트 uv run ruff format tests/test_hook_runtime_layout.py
타입체크 이번 PR 범위에서는 별도 실행하지 않음

남은 리스크 / 후속 작업

  • .harness/reference/local-adaptation.md의 남은 hook 관련 문구를 별도 문서 정리 PR에서 정돈
  • tests/test_graphify_harness.py에 섞여 있는 다른 주제 변경을 별도 PR로 분리
  • 주의할 점:
    • 현재 로컬 worktree에는 이번 PR과 무관한 unstaged 변경이 남아 있어 push는 commit-scoped 검증과 PR CI를 기준으로 진행했습니다.
  • 리뷰 시 특히 볼 부분:
    • wrapper 경로가 모두 기존 호출 경로를 유지하는지
    • scripts/hooks/graphify-auto-refresh.sh의 bare-worktree fallback이 기존 동작을 유지하는지

Codex added 2 commits April 21, 2026 15:00
Move canonical git and Claude hook logic into scripts/hooks while keeping .githooks, scripts/git-hooks, and .harness/hooks as stable wrapper entrypoints. Add focused regression coverage for the new hook layout and wrapper delegation.
@pko89403
pko89403 force-pushed the codex/git-hook-refactor branch from 404b362 to 23a58ce Compare April 21, 2026 06:01
Update existing harness and execute tests to read canonical scripts for implementation assertions while keeping wrapper entrypoints under .harness/hooks.
@pko89403
pko89403 merged commit 289f5f5 into main Apr 21, 2026
2 checks passed
@pko89403
pko89403 deleted the codex/git-hook-refactor branch April 21, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant