From 76c94bbe085847c3d680376856167ea5c331de13 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 19 Aug 2025 05:47:29 +0000 Subject: [PATCH] docs: add comprehensive debug hook guide for team members Consolidates all debug hook documentation into single comprehensive guide. Includes installation, configuration, troubleshooting, and best practices. - Quick installation with automated script - Manual installation options - Configuration customization - Troubleshooting guide - Team workflow recommendations - Emergency bypass procedures --- doc/debug-hook-guide.md | 165 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 doc/debug-hook-guide.md diff --git a/doc/debug-hook-guide.md b/doc/debug-hook-guide.md new file mode 100644 index 00000000..2b029d33 --- /dev/null +++ b/doc/debug-hook-guide.md @@ -0,0 +1,165 @@ +# 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**: `