Skip to content

Add git hooks integration #9

@scottbaggett

Description

@scottbaggett

Feature Request: Git Hooks Integration

Problem Statement

Teams want to automatically generate context for code reviews or ensure quality before commits.

Proposed Solution

Provide git hook scripts and integration guides for automated dex usage.

Implementation Details

Hook Types

  1. pre-commit: Check for secrets, generate context
  2. prepare-commit-msg: Add context to commit messages
  3. pre-push: Generate PR context
  4. post-checkout: Brief context for branch switches

Installation

dex install-hooks              # Install all hooks
dex install-hooks --pre-commit # Specific hook

Example pre-commit hook

#\!/bin/bash
# Check for secrets before commit
dex --secure=block || exit 1

# Generate context for commit message
CONTEXT=$(dex --format=markdown --no-metadata)
echo "$CONTEXT" > .git/DEX_CONTEXT

Example prepare-commit-msg

#\!/bin/bash
# Add AI-generated summary to commit message
SUMMARY=$(dex --format=gpt | some-ai-tool)
echo -e "\n\nAI Summary:\n$SUMMARY" >> $1

Configuration

.dex-hooks.yml:

pre-commit:
  secure: block
  format: markdown
  
prepare-commit-msg:
  enabled: true
  ai-summary: true

Benefits

  • Automated security checks
  • Consistent PR descriptions
  • AI-assisted commit messages
  • Team workflow enforcement

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions