Skip to content

훅 가드/리마인더 로직 단일화 (#46)#47

Merged
robinjoon merged 3 commits into
mainfrom
ticket/#46
May 3, 2026
Merged

훅 가드/리마인더 로직 단일화 (#46)#47
robinjoon merged 3 commits into
mainfrom
ticket/#46

Conversation

@robinjoon
Copy link
Copy Markdown
Member

@robinjoon robinjoon commented May 3, 2026

Summary

  • Claude Code hooks(.claude/hooks/*.py)와 OpenCode plugins(.opencode/plugins/*.js)에 두 언어로 중복 구현되어 있던 가드/리마인더 5종을 단일 TypeScript 코어(hooks/core/)로 통합
  • 각 시스템은 얇은 어댑터로만 호출 — Claude: hooks/adapters/claude/run.mjs dispatcher (stdin/exit code), OpenCode: .opencode/plugins/loop-hooks.js (인-프로세스 throw)
  • OpenCode 측에 누락되어 있던 plan-completion-guard도 자연스럽게 추가됨
  • 포매팅(markdown_formatter, ktlint-format, markdown-formatter.js)은 통합 범위 외로 그대로 유지

Changes

  • hooks/core/: 5개 코어 모듈 + lib/plan-scanner.ts, lib/path.ts 공유 라이브러리
  • hooks/adapters/claude/run.mjs: 단일 dispatcher
  • hooks/__tests__/: 122개 단위 테스트
  • .opencode/plugins/loop-hooks.js: 단일 통합 플러그인 + 7개 어댑터 테스트
  • 기존 Python 5종, JS 4종, .opencode/lib/ 삭제
  • CLAUDE.md에 Bun 1.x 런타임 의존성 명시

Closes #46

Test plan

  • cd hooks && bun test — 122 pass / 0 fail
  • cd .opencode && bun test plugins/__tests__ — 7 pass / 0 fail
  • Claude dispatcher 라이브 스모크: rm -rf / 차단, ls -la 통과
  • 본 세션에서 신규 dispatcher 기반 PostToolUse 훅이 plan-update-reminder를 정상 트리거함을 반복 확인
  • 양 시스템에서 gh pr create / git push 차단/허용 라이브 검증 (PR 작성 시점 본 케이스로 확인됨)

🤖 Generated with Claude Code

robinjoon and others added 3 commits May 3, 2026 23:59
Claude Code hooks(`.claude/hooks/*.py`)와 OpenCode plugins(`.opencode/plugins/*.js`)에
동일한 로직이 두 언어로 중복 구현되어 발생하던 드리프트를 제거.

- `hooks/core/`에 단일 진실 소스 (block-dangerous, work-plan-enforcer,
  plan-completion-guard, plan-update-reminder, layer-doc-reminder)
- Claude는 `hooks/adapters/claude/run.mjs` dispatcher가 stdin/exit code 변환
- OpenCode는 `.opencode/plugins/loop-hooks.js`가 인-프로세스 throw로 변환
- OpenCode 측에서도 plan-completion-guard 동작 (이전엔 누락)
- 단위 테스트 122건 + OpenCode 어댑터 테스트 7건 통과

포매팅(`markdown_formatter`, `ktlint-format`)은 통합 범위 외로 그대로 유지.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@robinjoon robinjoon merged commit 4f20efb into main May 3, 2026
1 check passed
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.

훅 가드/리마인더 로직 단일화 (Claude Code ↔ OpenCode)

1 participant