surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| 1 | #!/bin/bash |
| 2 | # Validate all hooks.json files in the repository |
| 3 | # This script can be run in CI to ensure all plugins have valid hook configurations |
| 4 | |
| 5 | set -euo pipefail |
| 6 | |
| 7 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 8 | REPO_ROOT="$(dirname "$SCRIPT_DIR")" |
| 9 | VALIDATOR="$REPO_ROOT/plugins/plugin-dev/skills/hook-development/scripts/validate-hook-schema.sh" |
| 10 | |
| 11 | echo "🔍 Validating all hooks.json files in the repository..." |
| 12 | echo "" |
| 13 | |
| 14 | # Find all hooks.json files |
| 15 | mapfile -t HOOKS_FILES < <(find "$REPO_ROOT/plugins" -name "hooks.json" -type f 2>/dev/null) |
| 16 | |
| 17 | if [ ${#HOOKS_FILES[@]} -eq 0 ]; then |
| 18 | echo "No hooks.json files found" |
| 19 | exit 0 |
| 20 | fi |
| 21 | |
| 22 | echo "Found ${#HOOKS_FILES[@]} hooks.json file(s)" |
| 23 | echo "" |
| 24 | |
| 25 | errors=0 |
| 26 | for hooks_file in "${HOOKS_FILES[@]}"; do |
| 27 | relative_path="${hooks_file#$REPO_ROOT/}" |
| 28 | echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" |
| 29 | echo "📄 $relative_path" |
| 30 | echo "" |
| 31 | |
| 32 | if bash "$VALIDATOR" "$hooks_file"; then |
| 33 | echo "" |
| 34 | else |
| 35 | echo "" |
| 36 | ((errors++)) |
| 37 | fi |
| 38 | done |
| 39 | |
| 40 | echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" |
| 41 | echo "" |
| 42 | |
| 43 | if [ $errors -eq 0 ]; then |
| 44 | echo "✅ All ${#HOOKS_FILES[@]} hooks.json file(s) are valid!" |
| 45 | exit 0 |
| 46 | else |
| 47 | echo "❌ $errors hooks.json file(s) have validation errors" |
| 48 | exit 1 |
| 49 | fi |