Git hooks were only in .git/hooks/ which isn't tracked by git. Created a shared githooks/ directory so all contributors get the pre-commit hook that enforces SDLC requirements. Changes: - githooks/pre-commit: Pre-commit hook enforcing SDLC (lint, tests, docs) - scripts/setup-githooks.sh: Script to configure git core.hooksPath - README.md: Added first-time setup instructions - AGENTS.md: Updated startup steps and project structure Users/agents run ./scripts/setup-githooks.sh after cloning to enable hooks. Reference: docs/SDLC.md 💘 Generated with Crush Assisted-by: GLM-5 via Crush <crush@charm.land>
44 lines
1.1 KiB
Bash
Executable File
44 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# KNEL-Football Secure OS - Git Hooks Setup
|
|
# Configures git to use the shared hooks from the githooks/ directory
|
|
#
|
|
# Run this once after cloning the repository:
|
|
# ./scripts/setup-githooks.sh
|
|
#
|
|
# Copyright (c) 2026 Known Element Enterprises LLC
|
|
# License: GNU Affero General Public License v3.0 only
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
HOOKS_DIR="$REPO_ROOT/githooks"
|
|
|
|
echo "Setting up git hooks..."
|
|
echo "Repository: $REPO_ROOT"
|
|
echo "Hooks directory: $HOOKS_DIR"
|
|
|
|
# Verify hooks directory exists
|
|
if [[ ! -d "$HOOKS_DIR" ]]; then
|
|
echo "ERROR: githooks/ directory not found"
|
|
exit 1
|
|
fi
|
|
|
|
# Make all hooks executable
|
|
chmod +x "$HOOKS_DIR"/*
|
|
|
|
# Configure git to use the shared hooks directory
|
|
git -C "$REPO_ROOT" config core.hooksPath githooks/
|
|
|
|
# Verify configuration
|
|
CONFIGURED_PATH=$(git -C "$REPO_ROOT" config --get core.hooksPath)
|
|
echo ""
|
|
echo "Git hooks configured successfully!"
|
|
echo " core.hooksPath = $CONFIGURED_PATH"
|
|
echo ""
|
|
echo "Available hooks:"
|
|
ls -1 "$HOOKS_DIR"
|
|
echo ""
|
|
echo "Hooks are now active for this repository."
|