Files
clean-architecture-frontend…/.gitignore
DongHyeonka 2d61bad023 feat(claude): reviewer 서브에이전트의 Bash를 읽기 전용 가드로 막는다
문제: reviewer는 Bash를 갖고 본문에 「읽기 명령만 쓴다」고만 적혀 있다. 모델이
그 줄을 어기면 리뷰 중에 작업 트리를 바꾸거나 git 상태를 옮길 수 있고, 막는 장치가 없다.

방법: reviewer 머리 칸에 PreToolUse(Bash) 가드를 건다. 가드는 허용 목록 방식이라
`git diff/log/show/grep`과 `python3 -I scripts/check-work-docs.py`만 통과하고, 그 밖의
명령·출력 돌리기·줄바꿈 뒤 명령은 rc 2로 막는다. 스크립트와 시험은 프로젝트 문서
저장소의 공용 사본을 고치지 않고 `.claude/hooks/`에 둔다. `.claude/*`를 무시하는
`.gitignore`에 `!.claude/hooks/`를 더해 함께 배포한다. 본문의 python 줄은 가드와 같게
`-I`를 붙였다. repo 훅 README 1절의 「막지 않는다」에 이 예외를 적는다.
`scripts/tests/test_agent_guard.py`는 가드 자체 시험을 돌리고, 머리 칸에 적힌 그대로의
인자로 본문의 허용 명령은 rc 0, 쓰는 명령은 rc 2인지 본다. Bash를 가진 에이전트는
가드를 걸거나 그 시험의 UNGUARDED에 까닭과 함께 적어야 한다. CI의 scripts/tests step이
이 시험을 돈다. `.gitignore` 시험 목록에 `!.claude/hooks/`를 더하고, 문서 작성 순서의
`check-work-docs.py` 호출도 가드 인자와 같게 `-I`를 붙인다.
- 버린 대안: `scripts/hooks/`에 두기. 그 폴더는 settings.json이 거는 알림 훅
  `hooks.py` 하나만 두는 곳이라 성격이 다르다.
- verify-app은 걸지 않았다. 원격 묶음 명령(`ssh desktop '<cd·flock·pnpm>'`)과 임시
  spec 쓰기를 명령 앞머리 하나로 좁힐 수 없다. arch-reviewer는 Bash가 없다.

위험·한계: 사고 방지용이다. 허용한 명령 안에서 일부러 돌아가는 것은 못 막는다.
`cd <폴더> && git diff`는 막히니 `git -C <폴더>`를 쓴다.

검증:
- python3 -I .claude/hooks/test_readonly_bash.py: 9 tests OK
- 가드 직접 입력: 허용 8개 rc 0, touch·>·줄바꿈 touch·checkout·stash·-I 없는 python·
  --output·cd 8개 rc 2
- 새 프로세스 guard_probe(reviewer, git log --oneline -3): rc 0, 가드가 막은 줄 3
- python3 -I -m unittest discover -s scripts/tests: 112 OK
- 변이 넷(머리 칸 가드 빼기, --git에서 diff 빼기, 본문의 -I 빼기, 가드 없는 Bash
  에이전트 더하기)이 각각 test_agent_guard.py의 시험 하나를 떨어뜨림
- scripts/verify.sh docs rc 0, scripts/verify.sh hooks rc 0
2026-12-03 02:48:48 +09:00

47 lines
1.4 KiB
Plaintext

node_modules/
dist/
.vite/
.generated/
.tmp/
playwright-report/
test-results/
coverage/
!tests/fixtures/coverage/
!tests/fixtures/coverage/below-threshold.json
# artifacts/ is run output and is ignored as a whole. Ignoring it by extension
# let screenshots and a coverage report in (0929/14-01) and step logs until
# they got their own rule (1103/12-08).
# Only the folder markers are tracked (R3); the manual a11y reviews people
# write are in docs/accessibility/route-reviews/.
# tests/unit/tracked-artifacts.test.ts keeps it so. Git cannot re-include a
# file under an ignored folder, so each folder on the way is re-included and
# its contents ignored again.
artifacts/*
!artifacts/runbooks/
artifacts/runbooks/*
!artifacts/runbooks/.gitkeep
!artifacts/tests/
artifacts/tests/*
!artifacts/tests/.gitkeep
# Local environment overrides. `.env.example` is the tracked template; every
# other `.env*` file is a developer's own machine and never enters the repo.
.env
.env.*
!.env.example
# graphify knowledge-graph output (local analysis, not part of the product).
graphify-out/
# Claude Code: the project settings, path rules, skills, subagents and the
# subagent guard (.claude/hooks/) are the template's (AGENTS.md,
# scripts/hooks/README.md). Session worktrees, the hook state and a developer's
# settings.local.json stay out.
.claude/*
!.claude/settings.json
!.claude/rules/
!.claude/agents/
!.claude/skills/
!.claude/hooks/
__pycache__/