-
Notifications
You must be signed in to change notification settings - Fork 1
feat(claude): add Claude Code hookify plugin #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dbb6ea8
feat(claude): enable hookify plugin and add local hook rules
kimchanhyung98 37f68dd
docs(claude): update local hookify rules and documentation prompts
kimchanhyung98 b0ee231
feat(hook): add custom notification hook script for Claude
kimchanhyung98 10a32e6
fix: disable require-tests hook locally
kimchanhyung98 b2b1985
fix(gemini): update .claude/hooks/notify.sh
kimchanhyung98 59ca8df
fix(gemini): update .claude/hookify.warn-security.local.md
kimchanhyung98 bf632ff
fix(hookify): improve regex pattern for nested directories
kimchanhyung98 ae1ca25
perf(hooks): optimize notify.sh by eliminating duplicate jq calls
kimchanhyung98 9939dcb
fix(copilot): update .claude/hookify.sync-docs.local.md
kimchanhyung98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| name: block-packages | ||
| enabled: true | ||
| event: file | ||
| action: block | ||
| conditions: | ||
| - field: file_path | ||
| operator: regex_match | ||
| pattern: node_modules/|vendor/|\.venv/|venv/|__pycache__/|\.git/ | ||
|
kimchanhyung98 marked this conversation as resolved.
Outdated
|
||
| --- | ||
|
|
||
| 🛑 **Dependency folder edit blocked** | ||
|
|
||
| 이 폴더의 파일은 직접 편집할 수 없습니다: | ||
|
|
||
| - `node_modules/`, `vendor/` - 패키지 매니저 관리 폴더 | ||
| - `.venv/`, `venv/`, `__pycache__/` - Python 환경/캐시 | ||
| - `.git/` - Git 내부 데이터 | ||
|
|
||
| 변경사항은 패키지 재설치 시 손실되며, 버전 관리에 포함되지 않습니다. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| name: require-tests | ||
| enabled: false | ||
| event: stop | ||
| action: block | ||
| conditions: | ||
| - field: transcript | ||
| operator: not_contains | ||
| pattern: npm test|yarn test|pnpm test|pytest|phpunit|pest|cargo test|go test | ||
|
kimchanhyung98 marked this conversation as resolved.
|
||
| --- | ||
|
|
||
| # TODO : make test, make check 등으로 변경해서 사용 | ||
|
|
||
| ⚠️ **Tests not detected in transcript** | ||
|
|
||
| 작업 완료 전 테스트 실행이 감지되지 않았습니다. | ||
|
|
||
| 변경사항이 정상 동작하는지 확인하기 위해, 프로젝트에 맞는 테스트 명령어 중 **하나를 실행**하세요: | ||
|
|
||
| - JavaScript/TypeScript: `npm test`, `yarn test`, `pnpm test` | ||
| - PHP: `phpunit`, `pest` | ||
| - Python: `pytest` | ||
| - Go: `go test` | ||
| - Rust: `cargo test` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| --- | ||
| name: sync-docs | ||
| enabled: true | ||
| event: file | ||
| action: warn | ||
| conditions: | ||
| - field: file_path | ||
| operator: regex_match | ||
| pattern: \.(php|ts|js|py|svelte|cs|rs)$ | ||
|
kimchanhyung98 marked this conversation as resolved.
Outdated
|
||
| --- | ||
|
|
||
| 📝 **Documentation sync required** | ||
|
|
||
| 코드가 변경되었습니다. `app/Domains/{domain}/docs/`의 관련 문서를 **추가하거나 갱신**해야 하는지 확인하세요: | ||
|
kimchanhyung98 marked this conversation as resolved.
|
||
|
|
||
| - 새 기능 추가 시 → 문서 **생성** 필요 | ||
| - 기존 기능 수정/삭제 시 → 문서 **갱신** 필요 | ||
|
|
||
| [ ] `adr/*.md` - 아키텍처 결정사항 변경 시 | ||
| [ ] `bpmn.md` - 비즈니스 프로세스 흐름 변경 시 | ||
| [ ] `planning.md` - 기능 계획/요구사항 변경 시 | ||
| [ ] `tech-spec.md` - 기술 명세/API 스펙 변경 시 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| name: warn-security | ||
| enabled: true | ||
| event: file | ||
| action: warn | ||
| conditions: | ||
| - field: new_text | ||
| operator: regex_match | ||
| pattern: console\.log\(|debugger;|var_dump\(|dd\(|print_r\(|(api[_-]?key|secret[_-]?key|password|token|auth[_-]?token)\s*[=:]\s*["'][^"']{8,}["'] | ||
|
kimchanhyung98 marked this conversation as resolved.
Outdated
kimchanhyung98 marked this conversation as resolved.
Outdated
|
||
| --- | ||
|
|
||
| ⚠️ **Debug code or hardcoded secret detected** | ||
|
|
||
| 커밋 전 확인이 필요한 패턴이 감지되었습니다: | ||
|
|
||
| - 디버그 코드: `console.log`, `debugger`, `var_dump`, `dd`, `print_r` | ||
| - 하드코딩된 시크릿: `api_key`, `password`, `token` 등 | ||
|
|
||
| 감지된 파일 경로와 라인 번호를 사용자에게 알려주세요. 의도된 코드일 수 있으므로 직접 제거하지 마세요. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| #!/bin/bash | ||
| # Claude Code task completion notification | ||
| # Enhanced version with prompt preview from history | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Read stdin JSON input | ||
| INPUT=$(cat) | ||
|
|
||
| # Configuration | ||
| NOTIFY_SOUND="${CLAUDE_NOTIFY_SOUND:-Glass}" | ||
| NOTIFY_TITLE="${CLAUDE_NOTIFY_TITLE:-Claude Code}" | ||
| HISTORY_FILE="${HOME}/.claude/history.jsonl" | ||
| PROMPT_LENGTH=30 | ||
|
|
||
| # Extract session_id from hook input | ||
| SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // empty' 2>/dev/null) | ||
|
|
||
| # Get last prompt for this session from history.jsonl | ||
| get_prompt_preview() { | ||
| if [[ -z "$SESSION_ID" ]] || [[ ! -f "$HISTORY_FILE" ]]; then | ||
| echo "" | ||
| return | ||
| fi | ||
|
|
||
| # Find the last entry for this session and get display field | ||
| local prompt | ||
| prompt=$(grep "\"sessionId\":\"$SESSION_ID\"" "$HISTORY_FILE" 2>/dev/null | tail -1 | jq -r '.display // empty' 2>/dev/null) | ||
|
kimchanhyung98 marked this conversation as resolved.
kimchanhyung98 marked this conversation as resolved.
kimchanhyung98 marked this conversation as resolved.
|
||
|
|
||
| if [[ -n "$prompt" ]]; then | ||
| # Remove newlines and truncate | ||
| local cleaned | ||
| cleaned=$(echo "$prompt" | tr '\n' ' ' | sed 's/ */ /g') | ||
| if [[ ${#cleaned} -gt $PROMPT_LENGTH ]]; then | ||
| echo "${cleaned:0:$PROMPT_LENGTH}..." | ||
| else | ||
| echo "$cleaned" | ||
| fi | ||
| else | ||
| echo "" | ||
| fi | ||
| } | ||
|
|
||
| # Determine status based on stop reason | ||
| get_status() { | ||
| local reason | ||
| reason=$(echo "$INPUT" | jq -r '.stop_reason // empty' 2>/dev/null) | ||
|
kimchanhyung98 marked this conversation as resolved.
Outdated
|
||
|
|
||
| case "$reason" in | ||
| end_turn) echo "✓" ;; | ||
| max_tokens) echo "⚠" ;; | ||
| stop_sequence) echo "■" ;; | ||
| tool_use) echo "⚙" ;; | ||
| *) echo "●" ;; | ||
| esac | ||
| } | ||
|
|
||
| # Get sound based on context | ||
| get_sound() { | ||
| local reason | ||
| reason=$(echo "$INPUT" | jq -r '.stop_reason // empty' 2>/dev/null) | ||
|
|
||
| case "$reason" in | ||
| end_turn) echo "Glass" ;; | ||
| max_tokens) echo "Basso" ;; | ||
| *) echo "$NOTIFY_SOUND" ;; | ||
| esac | ||
| } | ||
|
|
||
| # Main | ||
| STATUS=$(get_status) | ||
| PROMPT=$(get_prompt_preview) | ||
| SOUND=$(get_sound) | ||
|
|
||
| # Build message | ||
| if [[ -n "$PROMPT" ]]; then | ||
| MESSAGE="${STATUS} ${PROMPT}" | ||
| else | ||
| MESSAGE="${STATUS} Task completed" | ||
| fi | ||
|
|
||
| # Send notification | ||
| osascript -e "display notification \"${MESSAGE}\" with title \"${NOTIFY_TITLE}\" sound name \"${SOUND}\"" | ||
|
kimchanhyung98 marked this conversation as resolved.
Outdated
kimchanhyung98 marked this conversation as resolved.
Outdated
|
||
|
|
||
|
kimchanhyung98 marked this conversation as resolved.
Outdated
|
||
| exit 0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.