Hook#buildwithclaude
0
File protection hook
Kritik dosyaları yanlışlıkla değiştirilmeye karşı koruyun
yazan kuscubasiece·8 Eylül 2026
Kaynak: davepoon/claude-code-subagents-collection · MIT
Kritik dosyaları yanlışlıkla değiştirilmeye karşı koruyun
Kaynak: davepoon/claude-code-subagents-collection · MIT
curl -sL https://www.antrophiclove.com/api/kaynak/file-protection-hook/rawBu içerik mevcut dosyaya elle harmanlanmalı: .claude/settings.json
Protect critical files from accidental modification
PreToolUseEdit|MultiEdit|WriteNone required
None
file_path=$(jq -r '.tool_input.file_path // empty')
protected_patterns=('.env' 'package-lock.json' '.git/' 'node_modules/' 'secrets')
for pattern in "${protected_patterns[@]}"; do
if [[ "$file_path" == *"$pattern"* ]]; then
echo "Blocked: Cannot modify protected file: $file_path" >&2
exit 2
fi
done
exit 0