chore: import upstream snapshot with attribution
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:38:58 +08:00
commit bb5c75ce05
8824 changed files with 1946442 additions and 0 deletions
@@ -0,0 +1,16 @@
{
"description": "Create automatic backup of files before any Edit operation for safety. This hook creates a timestamped backup copy (filename.backup.timestamp) of any existing file before Claude modifies it. Provides a safety net to recover previous versions if needed. Only backs up existing files, includes error suppression to handle edge cases gracefully.",
"hooks": {
"PreToolUse": [
{
"matcher": "Edit",
"hooks": [
{
"type": "command",
"command": "if [[ -f \"$CLAUDE_TOOL_FILE_PATH\" ]]; then cp \"$CLAUDE_TOOL_FILE_PATH\" \"$CLAUDE_TOOL_FILE_PATH.backup.$(date +%s)\" 2>/dev/null || true; fi"
}
]
}
]
}
}
@@ -0,0 +1,16 @@
{
"description": "Warns about console.log statements when editing files on production branches (main/master). Helps prevent debug code from reaching production.",
"hooks": {
"PreToolUse": [
{
"matcher": "Edit",
"hooks": [
{
"type": "command",
"command": "if git rev-parse --git-dir >/dev/null 2>&1 && [[ -n \"$CLAUDE_TOOL_FILE_PATH\" ]]; then BRANCH=$(git branch --show-current 2>/dev/null); if [[ \"$BRANCH\" =~ ^(main|master|production|prod)$ ]]; then EXT=\"${CLAUDE_TOOL_FILE_PATH##*.}\"; if [[ \"$EXT\" =~ ^(js|ts|jsx|tsx|mjs|cjs)$ ]]; then LOGS=$(grep -n 'console\\.' \"$CLAUDE_TOOL_FILE_PATH\" 2>/dev/null); if [[ -n \"$LOGS\" ]]; then echo \"⚠️ WARNING: console statements found on '$BRANCH' branch:\"; echo \"$LOGS\" | head -5; COUNT=$(echo \"$LOGS\" | wc -l); if [[ $COUNT -gt 5 ]]; then echo \"... and $((COUNT-5)) more\"; fi; echo \"Consider removing debug statements before merging.\"; fi; fi; fi; fi"
}
]
}
]
}
}
@@ -0,0 +1,16 @@
{
"description": "Show notification before any Bash command execution for security awareness. This hook displays a simple echo message '🔔 About to run bash command...' before Claude executes any bash command, giving you visibility into when system commands are about to run. Useful for monitoring and auditing command execution.",
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "echo '🔔 About to run bash command...'"
}
]
}
]
}
}
@@ -0,0 +1,17 @@
{
"description": "Automatically adds current year to WebSearch queries when no year is specified. This hook intercepts WebSearch tool usage and appends the current year to queries that don't already contain a year, ensuring search results are current and relevant.",
"hooks": {
"PreToolUse": [
{
"matcher": "WebSearch",
"hooks": [
{
"type": "command",
"command": "python3 -c \"import json, sys, re; from datetime import datetime; input_data = json.load(sys.stdin); tool_input = input_data.get('tool_input', {}); query = tool_input.get('query', ''); current_year = str(datetime.now().year); has_year = re.search(r'\\\\b20\\\\d{2}\\\\b', query); has_temporal = any(word in query.lower() for word in ['latest', 'recent', 'current', 'new', 'now', 'today']); should_add_year = not has_year and not has_temporal; modified_query = f'{query} {current_year}' if should_add_year else query; output = {'hookSpecificOutput': {'hookEventName': 'PreToolUse', 'modifiedToolInput': {'query': modified_query}}}; print(json.dumps(output)); sys.exit(0)\"",
"timeout": 5
}
]
}
]
}
}