# TimeSafari Debug Hook Guide **Complete Guide for Team Members** **Date**: 2025-01-27 **Author**: Matthew Raymer **Status**: โœ… **ACTIVE** - Ready for production use ## ๐ŸŽฏ Overview A pre-commit hook that automatically detects and prevents debug code from reaching protected branches (master, main, production, release, stable). This ensures production code remains clean while allowing free development on feature branches. ## ๐Ÿš€ Quick Installation **From within the TimeSafari repository:** ```bash ./scripts/install-debug-hook.sh ``` This automatically installs, updates, and verifies the hook in your current repository. ## ๐Ÿ”ง Manual Installation **Copy files manually:** ```bash cp .git/hooks/pre-commit /path/to/your/repo/.git/hooks/ cp .git/hooks/debug-checker.config /path/to/your/repo/.git/hooks/ chmod +x /path/to/your/repo/.git/hooks/pre-commit ``` ## ๐Ÿ“‹ What Gets Installed - **`pre-commit`** - Main hook script (executable) - **`debug-checker.config`** - Configuration file - **`README.md`** - Documentation and troubleshooting ## ๐ŸŽฏ How It Works 1. **Branch Detection**: Only runs on protected branches 2. **File Filtering**: Automatically skips tests, scripts, and documentation 3. **Pattern Matching**: Detects debug code using regex patterns 4. **Commit Prevention**: Blocks commits containing debug code ## ๐ŸŒฟ Branch Behavior - **Protected branches** (master, main, production, release, stable): Hook runs automatically - **Feature branches**: Hook is skipped, allowing free development with debug code ## ๐Ÿ” Debug Patterns Detected - **Console statements**: `console.log`, `console.debug`, `console.error` - **Template debug**: `Debug:`, `debug:` in Vue templates - **Debug constants**: `DEBUG_`, `debug_` variables - **HTML debug**: `