Skip to main content

Git Hooks Configuration

Current Setup (July 4, 2025)

Active Hooks

  1. Pre-commit Hook (pre-commit-hook-optimized.sh)

    • Validates Pine Script syntax and structure
    • Auto-updates changelog timestamps
    • Focuses on validation only
  2. Post-commit Hook (post-commit-hook-fixed.sh)

    • Auto-increments version numbers based on commit messages
    • Runs complete workflow automation
    • Includes infinite loop prevention
    • Creates follow-up commits with generated files

Commit Message Patterns for Version Bumping

  • feat: or feature: → Minor version bump (1.0.0 → 1.1.0)
  • breaking: or BREAKING: → Major version bump (1.0.0 → 2.0.0)
  • Default → Patch version bump (1.0.0 → 1.0.1)

Skip Options

  • [skip workflow] or [no workflow] - Skip pre-commit workflow
  • [skip ci] or [no hooks] - Skip post-commit automation
  • --no-verify - Skip all hooks

Workflow Files Generated Automatically

  • README.md - Updated version badges and content
  • docs/tv-description.txt - TradingView publication description
  • testing-checklist.md - QA checklist for testing
  • Pine script - Version increments and changelog updates

Installation Commands

# Install pre-commit hook (optimized version)
cp tools/pre-commit-hook.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

# Install post-commit hook (with loop prevention)
cp tools/post-commit-hook.sh .git/hooks/post-commit
chmod +x .git/hooks/post-commit

Benefits

Automated version managementConsistent workflow file generation
Validation before commitsPrevention of infinite loopsSmart commit message parsingArtifact cleanup and optimization

Hook File Management

Active Hook Files (Currently Used)

  • tools/pre-commit-hook.sh - ACTIVE (validation only)
  • tools/post-commit-hook.sh - ACTIVE (automation with loop prevention)

Installation Status

Both hooks are installed and testedLegacy hook files have been removedWorkflow automation is fully functional

Test Results (July 4, 2025)

✅ Pre-commit validation: Working
✅ Post-commit automation: Working
✅ Version bumping: Working (feat: 2.5.1 → 2.6.0)
✅ Auto-sync commits: Working
✅ Loop prevention: Working