---
task_id: task-2457
type: plan
scope: task
created: 2026-05-05
updated: 2026-05-05
status: completed
---

# 계획서: task-2457 — Phase 2-A Git Hooks (commit/push 가드)

**task**: task-2457
**목표**: start_task_guard 통과 + taskctl verify 통과 없이는 commit/push가 git hook 단계에서 차단되도록 강제한다.
**승인**: 회장 → 아누 → dev3-team (2026-05-05) "start guard 없이 commit 불가 / handoff 없이 takeover 불가 / taskctl verify 없이 push 불가"
**근거**: `memory/tasks/task-2457.md` (회장 직접 진단 명시)

---

## 목표

git에서 push/commit이 다음 7대 차단 조건 중 하나라도 해당하면 거부한다 (8가지 합격 케이스 명시).
설치/제거 스크립트는 1라인으로 동작하며, bypass는 `TASKCTL_BYPASS=1` + evidence 기록 시에만 허용된다.

## 범위

### 포함
- `scripts/git-hooks/pre-commit` (신규) — 4 FAIL + bypass + lock 기반
- `scripts/git-hooks/pre-push` (기존 enhance) — 4 FAIL + bypass + scope_check + verify fallback
- `scripts/install-git-hooks.sh`, `scripts/uninstall-git-hooks.sh`
- `memory/specs/git-hooks-spec.md`
- `tests/git_hooks/test_pre_commit.py`, `test_pre_push.py` (8 차단 + 4 PASS + bypass 검증)

### 제외 (Phase 2-B/D 이후)
- `scripts/taskctl_verify.py` (Phase 2-B owner = dev4 비슈누)
- 자동 mixed commit 복구 (감지+FAIL+freeze evidence까지만)
- pre-push와 taskctl_verify의 실제 연동 (Phase 2-D Integration)

## 위임 계획

- 1단계 (병렬): **루(백엔드)** — pre-commit / pre-push / install-uninstall / spec doc
- 2단계 (병렬): **모리건(테스터)** — pytest 8 차단 + 4 PASS + bypass evidence 검증
- 3단계 (다그다 직접): 라이브 E2E 시나리오 6개 차단 + 3 PASS — 셀(real git repo) 시나리오

## 검증 기준

- 정적: `shellcheck scripts/git-hooks/pre-commit scripts/git-hooks/pre-push scripts/install-git-hooks.sh scripts/uninstall-git-hooks.sh` → exit 0
- 단위: `pytest tests/git_hooks/ -v` → all PASS
- 라이브: 6 차단 케이스 모두 exit 1, 3 PASS 케이스 모두 exit 0
- bypass: TASKCTL_BYPASS=1 시 evidence 4 필드(bypass=true / timestamp / 실행자 / 사유) 기록 확인
- 셀프 QC 8항목, 마아트 독립 검증, Codex 사전+사후 리뷰
