Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "hooks": {
- "SessionStart": [
- {
- "matcher": "startup|resume",
- "hooks": [
- {
- "type": "command",
- "command": "python3 -c \"import json, sys, os; agents_content = open('AGENTS.md', 'r').read() if os.path.exists('AGENTS.md') else ''; output = {'hookSpecificOutput': {'hookEventName': 'SessionStart', 'additionalContext': agents_content}}; print(json.dumps(output))\"",
- "timeout": 30
- }
- ]
- }
- ],
- "UserPromptSubmit": [
- {
- "hooks": [
- {
- "type": "command",
- "command": "echo \"π― ALWAYS WORKSβ’ REMINDER\nβββββββββββββββββββββββββββββββββββββββββββββββββββββββ\nπ Core Philosophy:\n β’ 'Should work' β 'Does work'\n β’ Pattern matching isn't enough\n β’ Untested code is just a guess, not a solution\n\nβ The 30-Second Reality Check - Must answer YES to ALL:\n β‘ Did I run/build the code?\n β‘ Did I trigger the exact feature I changed?\n β‘ Did I see the expected result with my own eyes?\n β‘ Did I check for error messages?\n β‘ Would I bet $100 this works?\n\nπ« NEVER say:\n β 'This should work now'\n β 'I've fixed the issue' (especially 2nd+ time)\n β 'Try it now' (without trying it myself)\n β 'The logic is correct so...'\n\nπ Specific Test Requirements:\n β’ UI Changes β Actually click the button/link/form\n β’ API Changes β Make the actual API call\n β’ Data Changes β Query the database\n β’ Logic Changes β Run the specific scenario\n β’ Config Changes β Restart and verify it loads\n\nπ³ The Embarrassment Test:\n 'If the user records trying this and it fails,\n will I feel embarrassed to see their face?'\n\nβ° Time Reality:\n β’ Time saved skipping tests: 30 seconds\n β’ Time wasted when it doesn't work: 30 minutes\n β’ User trust lost: Immeasurable\n\nπ Remember: A user describing a bug for the third time\n isn't thinking 'this AI is trying hard' - they're\n thinking 'why am I wasting time with this tool?'\nβββββββββββββββββββββββββββββββββββββββββββββββββββββββ\"",
- "timeout": 5
- }
- ]
- }
- ],
- "PreToolUse": [
- {
- "matcher": "Edit|Write|Bash",
- "hooks": [
- {
- "type": "command",
- "command": "# Run pre-tool-use script if it exists\nif [ -f \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-tool-use.js\" ]; then\n node \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-tool-use.js\" 2>/dev/null || echo \"β οΈ Pre-tool-use script error (continuing anyway)\"\nfi",
- "timeout": 10
- }
- ]
- }
- ],
- "PostToolUse": [
- {
- "matcher": "Write|Edit|MultiEdit",
- "hooks": [
- {
- "type": "command",
- "command": "# Auto-format all modified files based on type\nfor file in $CLAUDE_FILE_PATHS; do\n # Python files - use black\n if [[ \"$file\" == *.py ]]; then\n if command -v black &> /dev/null; then\n echo \"π¨ Formatting Python: $(basename $file)\"\n black \"$file\" 2>/dev/null || true\n fi\n # TypeScript/JavaScript/React files - use prettier\n elif [[ \"$file\" == *.ts ]] || [[ \"$file\" == *.tsx ]] || [[ \"$file\" == *.js ]] || [[ \"$file\" == *.jsx ]]; then\n if command -v npx &> /dev/null; then\n echo \"π¨ Formatting TS/JS: $(basename $file)\"\n npx prettier --write \"$file\" 2>/dev/null || true\n fi\n # JSON/CSS/HTML/MD files - use prettier\n elif [[ \"$file\" == *.json ]] || [[ \"$file\" == *.css ]] || [[ \"$file\" == *.html ]] || [[ \"$file\" == *.md ]]; then\n if command -v npx &> /dev/null; then\n echo \"π¨ Formatting: $(basename $file)\"\n npx prettier --write \"$file\" 2>/dev/null || true\n fi\n fi\ndone",
- "timeout": 20,
- "run_in_background": true
- },
- {
- "type": "command",
- "command": "# Python Syntax Verification - ONLY for modified files\nfor file in $CLAUDE_FILE_PATHS; do\n if [[ \"$file\" == *lightrag/*.py ]] && [[ \"$file\" != *.pyc ]]; then\n echo \"π Verifying Python syntax: $(basename $file)\"\n python -c \"import ast; ast.parse(open('$file').read())\" 2>/dev/null\n if [ $? -ne 0 ]; then\n echo \"\\nβ PYTHON SYNTAX ERROR DETECTED in $(basename $file)!\"\n echo \"βββββββββββββββββββββββββββββββββββββββββββββββ\"\n python -c \"import ast; ast.parse(open('$file').read())\" 2>&1\n echo \"βββββββββββββββββββββββββββββββββββββββββββββββ\"\n echo \"π§ IMMEDIATE ACTION REQUIRED: Fix syntax before continuing!\"\n exit 2\n fi\n echo \"β Python syntax OK\"\n fi\ndone",
- "timeout": 10
- },
- {
- "type": "command",
- "command": "# TypeScript Compilation Check - ONLY for modified files\nfor file in $CLAUDE_FILE_PATHS; do\n if [[ \"$file\" == *lightrag_webui/*.tsx ]] || [[ \"$file\" == *lightrag_webui/*.ts ]]; then\n if [[ \"$file\" != *.d.ts ]]; then\n echo \"βοΈ Verifying TypeScript: $(basename $file)\"\n cd lightrag_webui 2>/dev/null && npx tsc --noEmit --skipLibCheck \"../$file\" 2>/dev/null\n if [ $? -ne 0 ]; then\n echo \"\\nβ TYPESCRIPT COMPILATION ERROR in $(basename $file)!\"\n echo \"βββββββββββββββββββββββββββββββββββββββββββββββ\"\n cd lightrag_webui && npx tsc --noEmit --skipLibCheck \"../$file\" 2>&1\n echo \"βββββββββββββββββββββββββββββββββββββββββββββββ\"\n echo \"π§ IMMEDIATE ACTION REQUIRED: Fix TypeScript errors!\"\n exit 2\n fi\n echo \"β TypeScript compilation OK\"\n fi\n fi\ndone",
- "timeout": 15
- },
- {
- "type": "command",
- "command": "# Architecture Pattern Verification - Quick checks\nfor file in $CLAUDE_FILE_PATHS; do\n if [[ \"$file\" == *lightrag/*.py ]]; then\n # Check for client_id usage (should be workspace_id)\n if grep -q \"client_id\" \"$file\" 2>/dev/null; then\n echo \"β οΈ ARCHITECTURE WARNING in $(basename $file):\"\n echo \" Found 'client_id' - Must use 'workspace_id' for isolation!\"\n grep -n \"client_id\" \"$file\" | head -3\n fi\n # Check for direct Supabase access without Service Factory\n if grep -q \"supabase\\.table\" \"$file\" 2>/dev/null; then\n if ! grep -q \"SupabaseServiceFactory\" \"$file\" 2>/dev/null; then\n echo \"β οΈ ARCHITECTURE WARNING in $(basename $file):\"\n echo \" Direct DB access detected - MUST use Service Factory pattern!\"\n echo \" Example: factory = SupabaseServiceFactory(workspace_id)\"\n fi\n fi\n fi\ndone",
- "timeout": 5
- }
- ]
- }
- ],
- "Stop": [
- {
- "hooks": [
- {
- "type": "command",
- "command": "echo 'π Task completed!' && mpg123 -q -g 50 '/mnt/c/Users/orhei/Desktop/AI Bot/bellsound.mp3' 2>/dev/null || true",
- "timeout": 5,
- "run_in_background": true
- }
- ]
- }
- ]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment