1 line
770 B
JSON
1 line
770 B
JSON
{"content": "{\n \"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.\",\n \"hooks\": {\n \"PreToolUse\": [\n {\n \"matcher\": \"Edit\",\n \"hooks\": [\n {\n \"type\": \"command\",\n \"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\"\n }\n ]\n }\n ]\n }\n}"} |