mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-03-12 21:23:05 -07:00
- Remove 6 duplicate per-version pytest workflows (matrix build covers all) - Pin GitHub Actions to SHA hashes with version comments - Add persist-credentials: false to checkout steps - Replace mypy with ty for type checking (faster, stricter) - Pin dev deps to exact versions (ty==0.0.17, ruff==0.15.1, pytest==9.0.2, pytest-cov==7.0.0) - Remove types-* stub packages (ty doesn't need them) - Remove stale [dependency-groups] section from pyproject.toml - Update shell scripts to use set -euo pipefail - Add prek.toml for git hook management (pre-push, post-commit) - Add lint-infra.yml workflow (shellcheck + actionlint) - Fix actionlint warning: pass github.head_ref through env var - Track CLAUDE.md and .claude/ scripts in git - Update README.md and Makefile references from mypy to ty Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
1.3 KiB
Bash
46 lines
1.3 KiB
Bash
#!/bin/bash
|
|
# Install Git Hooks for Documentation Auditing
|
|
# This script sets up a post-commit hook that automatically checks if
|
|
# documentation needs updating after each commit.
|
|
#
|
|
# Usage: .claude/install-hooks.sh
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
GIT_HOOKS_DIR="$PROJECT_ROOT/.git/hooks"
|
|
|
|
if [ ! -d "$GIT_HOOKS_DIR" ]; then
|
|
echo "Error: Not in a git repository"
|
|
exit 1
|
|
fi
|
|
|
|
# Create post-commit hook
|
|
POST_COMMIT_HOOK="$GIT_HOOKS_DIR/post-commit"
|
|
|
|
cat > "$POST_COMMIT_HOOK" << 'EOF'
|
|
#!/bin/bash
|
|
set -euo pipefail
|
|
# Auto-generated: Post-commit hook for documentation auditing
|
|
# Remove this file to disable automatic documentation audits.
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
|
AUDIT_SCRIPT="$PROJECT_ROOT/.claude/audit-docs.sh"
|
|
|
|
if [ -f "$AUDIT_SCRIPT" ]; then
|
|
bash "$AUDIT_SCRIPT" HEAD
|
|
fi
|
|
EOF
|
|
|
|
chmod +x "$POST_COMMIT_HOOK"
|
|
|
|
echo "✓ Post-commit hook installed at $POST_COMMIT_HOOK"
|
|
echo ""
|
|
echo "Documentation audits will now run automatically after each commit."
|
|
echo "To remove this behavior, delete: $POST_COMMIT_HOOK"
|
|
echo ""
|
|
echo "Alternatively, you can run audits manually:"
|
|
echo " bash .claude/audit-docs.sh HEAD"
|