BurningTimesAi/scripts/sync_audit_repo_to_central.sh

49 lines
1.9 KiB
Bash
Raw Normal View History

feat(#48 D·F·G): C36 신설 + audit 중앙 통합 + 관련 보완 G (a) audit 중앙 통합 (C34 3종 저장소 확장) - scripts/audit_junction_ensure.sh 신설 (SessionStart + UserPromptSubmit hook) - scripts/sync_audit_{repo_to_central,central_to_repo}.sh 신설 - memory/org/audit_logs/ SOT 디렉토리 신설 (PC별 hostname 폴더) - .claude/settings.json hook 체인 편입 - scripts/git-hooks/post-commit audit sync 추가 - SKILL.md C34-1·C34-3 3종 저장소 확장 + C34-17 audit 특수 조항 신설 G (b) 코어룰 보완 — PM 임의 변형 방지 (PD님 직접 지시) - SKILL.md C36 헌법급 신설 (PM 자율 판단 범위 상한 · 방향·원칙 수준 축소·희석 금지) - C36-2 판정 기준 3종 명시 (pm-auditor Major 지적 반영) - SKILL.md C31-1 H 그룹 신설 (C36 자기검증 강제) - SKILL.md P11 보완 (규칙 변경 제안에 C36 적용) - .claude/agents/pm-auditor.md 5-E 신설 - memory/org/feedback_pm_surface_rationale_proposal.md 적용 범위 제한 (방향·원칙 수준 오적용 금지) - memory/org/feedback_pm_over_conservative_interpretation.md 6회차 변종 기록 D. .live/README.md 복구 - 중앙 저장소 $HOME/.claude/nerdnavis-live/README.md 신설 - SKILL.md C34와 역할 분담 (실무 사용 쿡북) - .live/ junction 경유로 레포에서도 접근 E. 진행하지 않음 (PD님 지시) F. plan-auditor 2번 섹션에 백업 포맷 이미 반영 확인 (추가 확장 불요) pm-auditor 사전 감사 Major 1·Minor 2·Improvement 2 수용. 헌법 제1원칙 ⑤ 직결. feedback_pm_over_conservative_interpretation 6회차 변종 구조 차단. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 03:12:30 +00:00
#!/bin/bash
# SessionStart hook — 레포 memory/org/audit_logs/ 를 중앙으로 sync (git pull 직후 최신화)
# 2026-04-20 #48 G 집행 신설. C34-17 sync 4계층 중 "레포 → 중앙" 방향
# 각 PC hostname 폴더만 자기 PC 로그이고 그 외는 다른 PC 로그 (PC 간 공유)
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
[ -z "$REPO_ROOT" ] && exit 0
REPO_AUDIT="$REPO_ROOT/memory/org/audit_logs"
[ ! -d "$REPO_AUDIT" ] && exit 0
feat(BT·신설): 조직 신설 Phase 1 — git 저장소 교체 + 중앙 저장소 A안 분리 PD님 2026-04-21 직접 지시 5개 중 1·2·4 이행. ## 집행 내역 1. git remote: NerdNavisAi.git → BurningTimesAi.git 교체 (BT main + 본 worktree) - E:/NerdNavisAi 레포 원격은 원상 유지 (실측 확인) 2. 중앙 저장소 A안 분리: ~/.claude/burningtimes-{live,memory,audit}/ - nerdnavis-* 중앙 저장소에서 cp -r 복사 (원본 미변경) - .junction-marker 내용 BT로 갱신 3. 본 worktree .live junction 재연결 → burningtimes-live 4. audit junction 3종 신설: .burningtimes_{auditor_calls,warning_ignored,bypass_log} 5. scripts·setup 28파일 하드코딩 일괄 치환 (nerdnavis/NerdNavis/너드나비스/NERDNAVIS → burningtimes/BurningTimes/BURNINGTIMES) 6. paths.local.json.template BT 전용 재작성 (Unity·Framework 경로 __TBD__ placeholder) 7. .gitignore: .live.bak_*/ 패턴 추가 ## 보류 항목 (PD 재논의 예정) - 3. memory/org/ 내용 초기화 (PD 지시) - 5. Unity 프로젝트 경로 (PD 신규 경로 제공 전까지) - SKILL.md·CLAUDE.md 조직명 전환 및 P17·P29 처리 - 프로젝트/수상한잡화점/ 등 수상한잡화점 관련 일괄 정리 - 코어코드/NerdNavis.Framework/ → BT-프레임워크 이름 전환 - 공유/조직공지/ 너드나비스 맥락 공지 처리 - .claude/agents/*.md frontmatter skills 참조명 ## 감사 pm-auditor 사전 감사 통과 (Critical 0건, Major 2건 commit 전 정정 완료). 매니페스트: bt-org-split-phase1 (C35-9 PreToolUse 차단 해제). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 15:14:51 +00:00
CENTRAL_AUDIT="$HOME/.claude/burningtimes-audit"
feat(#48 D·F·G): C36 신설 + audit 중앙 통합 + 관련 보완 G (a) audit 중앙 통합 (C34 3종 저장소 확장) - scripts/audit_junction_ensure.sh 신설 (SessionStart + UserPromptSubmit hook) - scripts/sync_audit_{repo_to_central,central_to_repo}.sh 신설 - memory/org/audit_logs/ SOT 디렉토리 신설 (PC별 hostname 폴더) - .claude/settings.json hook 체인 편입 - scripts/git-hooks/post-commit audit sync 추가 - SKILL.md C34-1·C34-3 3종 저장소 확장 + C34-17 audit 특수 조항 신설 G (b) 코어룰 보완 — PM 임의 변형 방지 (PD님 직접 지시) - SKILL.md C36 헌법급 신설 (PM 자율 판단 범위 상한 · 방향·원칙 수준 축소·희석 금지) - C36-2 판정 기준 3종 명시 (pm-auditor Major 지적 반영) - SKILL.md C31-1 H 그룹 신설 (C36 자기검증 강제) - SKILL.md P11 보완 (규칙 변경 제안에 C36 적용) - .claude/agents/pm-auditor.md 5-E 신설 - memory/org/feedback_pm_surface_rationale_proposal.md 적용 범위 제한 (방향·원칙 수준 오적용 금지) - memory/org/feedback_pm_over_conservative_interpretation.md 6회차 변종 기록 D. .live/README.md 복구 - 중앙 저장소 $HOME/.claude/nerdnavis-live/README.md 신설 - SKILL.md C34와 역할 분담 (실무 사용 쿡북) - .live/ junction 경유로 레포에서도 접근 E. 진행하지 않음 (PD님 지시) F. plan-auditor 2번 섹션에 백업 포맷 이미 반영 확인 (추가 확장 불요) pm-auditor 사전 감사 Major 1·Minor 2·Improvement 2 수용. 헌법 제1원칙 ⑤ 직결. feedback_pm_over_conservative_interpretation 6회차 변종 구조 차단. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 03:12:30 +00:00
[ ! -d "$CENTRAL_AUDIT" ] && exit 0
HOSTNAME_TAG=$(hostname 2>/dev/null | tr -d '[:space:]' | tr -cd '[:alnum:]-_' | head -c 32)
[ -z "$HOSTNAME_TAG" ] && HOSTNAME_TAG="unknown"
SUBDIRS=("auditor_calls" "warning_ignored" "bypass_log")
# 자기 PC hostname 폴더: 레포 → 중앙 (unflushed 중앙 변경 대피 후 레포본 복원)
SELF_DIR="$REPO_AUDIT/$HOSTNAME_TAG"
if [ -d "$SELF_DIR" ]; then
for SUB in "${SUBDIRS[@]}"; do
CENTRAL_SUB="$CENTRAL_AUDIT/$SUB"
REPO_SUB="$SELF_DIR/$SUB"
[ ! -d "$REPO_SUB" ] && continue
mkdir -p "$CENTRAL_SUB" 2>/dev/null
for f in "$REPO_SUB"/*.log; do
[ -f "$f" ] || continue
BASENAME=$(basename "$f")
CENTRAL_FILE="$CENTRAL_SUB/$BASENAME"
# unflushed 중앙 대피: 중앙이 레포보다 최신이고 레포 HEAD 커밋 미반영이면 대피
if [ -f "$CENTRAL_FILE" ] && [ "$CENTRAL_FILE" -nt "$f" ]; then
if ! git -C "$REPO_ROOT" log --oneline HEAD -- "memory/org/audit_logs/$HOSTNAME_TAG/$SUB/$BASENAME" 2>/dev/null | grep -q .; then
CONFLICT="$CENTRAL_AUDIT.conflict-$(date +%Y%m%d_%H%M%S)"
mkdir -p "$CONFLICT/$SUB" 2>/dev/null
cp "$CENTRAL_FILE" "$CONFLICT/$SUB/$BASENAME" 2>/dev/null
echo "⚠️ [Audit Sync Repo→Central] 중앙 unflushed 대피: $CONFLICT/$SUB/$BASENAME" >&2
fi
fi
cp "$f" "$CENTRAL_FILE" 2>/dev/null
done
done
fi
exit 0