34 lines
1.3 KiB
Bash
34 lines
1.3 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
# PostToolUse hook (matcher: Task) — pm-auditor Task 호출 자동 기록
|
||
|
|
# C35-9 Layer 2: 감사관 호출 이력 자동 축적 + 경고 무시 사례 해소 처리
|
||
|
|
# 2026-04-19 신설 — PD님 직접 지시 "경고 무시 사례 발견 시 PD 우선 보고 + 감사 자산 축적"
|
||
|
|
# 관련: C35-9 hook 3층 구조 · C35-10 경고 무시 PD 보고 + 장기 패턴 분석
|
||
|
|
|
||
|
|
INPUT=$(cat 2>/dev/null)
|
||
|
|
|
||
|
|
# subagent_type이 pm-auditor인 경우만 기록
|
||
|
|
if ! echo "$INPUT" | grep -q '"subagent_type"[[:space:]]*:[[:space:]]*"pm-auditor"'; then
|
||
|
|
exit 0
|
||
|
|
fi
|
||
|
|
|
||
|
|
LOG_DIR="$HOME/.claude/.nerdnavis_auditor_calls"
|
||
|
|
mkdir -p "$LOG_DIR" 2>/dev/null
|
||
|
|
|
||
|
|
# 일자별 로그 파일에 호출 시각 기록
|
||
|
|
LOG_FILE="$LOG_DIR/$(date +%Y-%m-%d).log"
|
||
|
|
echo "$(date +%Y-%m-%d_%H:%M:%S) pm-auditor called" >> "$LOG_FILE"
|
||
|
|
|
||
|
|
# 경고 무시 사례 해소 처리 — 기존 UNRESOLVED 로그에 RESOLVED 마커 append
|
||
|
|
WARNING_DIR="$HOME/.claude/.nerdnavis_warning_ignored"
|
||
|
|
if [ -d "$WARNING_DIR" ]; then
|
||
|
|
for wf in "$WARNING_DIR"/*.log; do
|
||
|
|
[ -f "$wf" ] || continue
|
||
|
|
# 해당 파일에 UNRESOLVED 있고 아직 RESOLVED 미완료이면 해소 처리
|
||
|
|
if grep -q "UNRESOLVED" "$wf" 2>/dev/null && ! tail -1 "$wf" | grep -q "RESOLVED"; then
|
||
|
|
echo "$(date +%Y-%m-%d_%H:%M:%S) RESOLVED by pm-auditor call" >> "$wf"
|
||
|
|
fi
|
||
|
|
done
|
||
|
|
fi
|
||
|
|
|
||
|
|
exit 0
|