Template
Extract patterns from 18 projects across two machines (12 local infra + 6 remote personal/business via ssh survey). Ship a reusable Gitea template with AGENTS.md, 5 Crush PreToolUse hooks, git pre-commit/pre-push, a generalized rules engine, shared bash library, Makefile, lifecycle scripts, and gardening loop. Includes the canonical BASELINE-PROMPT.md (13 sections) and PATTERNS.md (standardization scorecard). The repo self-applies: it passes its own shellcheck (zero info-level), make fast, and all check-rules.sh checks. 💘 Generated with Crush Assisted-by: Crush via Crush <crush@charm.land>
26 lines
849 B
Bash
Executable File
26 lines
849 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# pre-commit — fast rule audit (< 1s typical).
|
|
# Hot-path bypass: commits that ONLY touch STATUS.md / JOURNAL.md / WORKING.md
|
|
# skip the audit so frequent status/journal commits stay frictionless.
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
|
cd "$REPO_ROOT"
|
|
|
|
CHANGED="$(git diff --cached --name-only)"
|
|
HOT_PATHS="$(printf '%s\n' "$CHANGED" | grep -vE '^(STATUS.md|docs/JOURNAL.md|WORKING.md)$' || true)"
|
|
|
|
if [ -z "$HOT_PATHS" ]; then
|
|
echo "hot-path files only (STATUS/JOURNAL/WORKING) — skipping rule audit"
|
|
exit 0
|
|
fi
|
|
|
|
if ! bash scripts/check-rules.sh --fast; then
|
|
echo ""
|
|
echo "pre-commit audit FAILED. Fix the violations above before committing."
|
|
echo "Full audit: bash scripts/check-rules.sh"
|
|
echo "Bypass: git commit --no-verify (emergencies only)"
|
|
exit 1
|
|
fi
|
|
exit 0
|