A git commit documentation automation system that installs post-commit hooks to automatically generate detailed commit logs, timeline reports, and branch documentation after every commit. Features security-first installation with PR-only workflow and comprehensive safety validations.
This project provides a comprehensive git commit documentation automation system with three main components:
- π Post-Commit Documentation - Automatically generates commit logs, timeline reports, and branch documentation after every commit
- π PR-Only Installer - Creates feature branch and requires manual review before merging
- π‘οΈ Reusable Security Framework - For other projects requiring secure git operations
# Clone the repository
git clone https://github.com/development-toolbox/development-toolbox-git-hooks-installer.git
cd development-toolbox-git-hooks-installer
# Install commit documentation hooks
python git-hooks-installer/git-hooks-installer.py /path/to/your/project
# Help and options
python git-hooks-installer/git-hooks-installer.py -hHelp Output:
usage: git-hooks-installer.py [-h] [-f] [-v] [-d] [--no-ci] [-c] [target]
Install/update git hooks, scripts, and documentation in a Git repository.
positional arguments:
target Path to the target Git repository where hooks will be
installed (default: current directory)
options:
-h, --help show this help message and exit
-f, --force Force reinstall even if up-to-date
-v, --verbose Enable verbose logging
-d, --debug Enable debug logging
--no-ci Skip CI/CD file installation
-c, --check Check current installation status
Examples:
git-hooks-installer.py # Install in current directory
git-hooks-installer.py /path/to/project # Install in specific git repository
git-hooks-installer.py -c # Check installation status
git-hooks-installer.py -f # Force reinstall
git-hooks-installer.py -v /path/to/project # Verbose installation in specific repo
git-hooks-installer.py -d --no-ci # Debug mode, skip CI files
# Check if git hooks are already installed
python git-hooks-installer/git-hooks-installer.py -c
# or use long flag
python git-hooks-installer/git-hooks-installer.py --check# Direct setup without PR workflow
python git-hooks-installer/developer-setup/setup_githooks.py- Installs post-commit hooks that automatically generate commit documentation
- Creates feature branch for installation (never commits directly to main)
- Requires manual PR review before changes are merged
- Validates repository state before installation
- Only commits installer files (never user files or secrets)
π development-toolbox-git-hooks-installer/
βββ π README.md # This file
βββ π CLAUDE.md # Project memory
βββ π git-hooks-installer/ # Main installer package
β βββ π git-hooks-installer.py # Security-first installer
β βββ π security/ # Security framework
β β βββ π secure_git_wrapper.py # Secure subprocess wrapper
β β βββ π file_tracker.py # file tracking
β β βββ π repository_validator.py # Pre-flight validation
β βββ π utils/ # Utility functions
β βββ π developer-setup/ # Manual setup tools
β βββ π archived/ # Legacy versions
βββ π docs/ # Documentation
β βββ π SECURITY-IMPLEMENTATION-FRAMEWORK.md # Reusable patterns
β βββ π commit-logs/ # Generated commit logs
βββ π tests/ # Multi-OS testing
β βββ π docker/ # Docker configurations
β βββ π user-stories/ # Business requirement tests
β βββ π results/ # Test results
βββ π code-style-tutorial/ # HTML tutorials (in development)
# Run comprehensive security tests across Ubuntu, AlmaLinux 9/10
./run_docker-tests.sh
# Run User Story validation tests
docker-compose -f tests/docker/docker-compose.user-story-tests.yml up --build --abort-on-container-exitThe installer validates against 5 key business requirements:
- US-001: Testing "safe" installation for developers with secrets
- US-002: Team lead code quality control via PR workflow
- US-003: Developer work-in-progress protection
- US-004: Cross-platform developer setup
- US-005: Repository administrator branch protection
-
SecureGitWrapper (
security/secure_git_wrapper.py)- Command whitelisting - only approved Git commands
- Argument validation - prevents flag injection
- Path sanitization - prevents traversal attacks
- Timeout protection - prevents hanging operations
-
FileTracker (
security/file_tracker.py)- Explicit file tracking - only installer files committed
- Staging validation - ensures clean commits
- Audit trails - comprehensive operation logging
-
RepositoryValidator (
security/repository_validator.py)- Pre-flight checks - validates repository state
- Branch validation - prevents conflicts
- Working tree validation - ensures clean state
# Import the security framework
from security import SecureGitWrapper, FileTracker, RepositoryValidator
# Use secure Git operations
git = SecureGitWrapper("/path/to/repo")
git.create_branch("feat/new-feature") # Validated and secureWhen you run the installer, it sets up:
- post-commit: Generates detailed commit logs automatically
- lock files: Prevents recursive execution
- branch-specific: Organizes logs by branch
- Conventional Commits: Standardized commit message format
- Automated logs: Generated in
docs/commit-logs/ - Timeline reports: Comprehensive project history
- Branch tracking: Separate logs per branch
- Cross-platform scripts: Shell (Linux/macOS) and PowerShell (Windows)
- Manual setup:
developer-setup/setup_githooks.py - CI/CD integration: GitHub Actions and GitLab CI support
- Pre-flight Checks - Validates repository state and requirements
- Feature Branch - Creates timestamped branch:
feat/githooks-installation-<timestamp> - Installation - Installs components with comprehensive file tracking
- Commit & Push - Commits only tracked files with detailed audit messages
- PR Instructions - Provides platform-specific PR creation links
- Manual Review - Team member reviews and approves changes
- Make commits using Conventional Commits format
- Automatic documentation generated after each commit
- Timeline reports updated with project history
- Branch-specific logs maintain clear audit trails
- π Installation Guide: git-hooks-installer/README.md
- π Security Details: git-hooks-installer/SECURITY-ENHANCEMENTS.md
- π‘οΈ Framework Guide: docs/SECURITY-IMPLEMENTATION-FRAMEWORK.md
- π Project Memory: CLAUDE.md
- π§ͺ Test Results: tests/user-stories/USER-STORY-TEST-RESULTS.md
This project follows the Conventional Commits standard for clear, automated commit history.
<type>(scope): <description>
Examples:
feat(installer): add secure subprocess wrapper
fix(security): resolve path validation issue
docs(readme): update installation instructions
test(user-stories): add US-001 validation test
- feat: New features
- fix: Bug fixes
- docs: Documentation updates
- test: Testing improvements
- refactor: Code improvements
- style: Code style changes
- chore: Maintenance tasks
π Learn more: conventionalcommits.org
- Follow Conventional Commits standard for all commit messages
- Use the secure installer for any hook-related changes
- All changes require PR review - no direct commits to main
- Run tests before submitting:
./run_docker-tests.sh - Update documentation when adding features
# Clone and setup
git clone https://github.com/development-toolbox/development-toolbox-git-hooks-installer.git
cd development-toolbox-git-hooks-installer
# Install hooks for this project
python git-hooks-installer/git-hooks-installer.py .
# Run tests
./run_docker-tests.shThe security framework can be used in other projects:
- Copy security package:
security/folder with all components - Adapt imports:
from security import SecureGitWrapper, FileTracker - Implement User Stories: Define business requirements as testable stories
- Set up testing: Docker-based multi-OS validation
- Documentation: Use
SECURITY-ENHANCEMENTS.mdtemplate
See SECURITY-IMPLEMENTATION-FRAMEWORK.md for complete implementation guide.
- Johan SΓΆrell
- GitHub: J-SirL
- LinkedIn: Johan SΓΆrell
This project is part of the development-toolbox ecosystem.
π Repository: https://github.com/development-toolbox/development-toolbox-git-hooks-installer