Files
automaton/scripts/install-hooks.sh
T
Lap Tran 0437cbae6c docs: architecture section, FAQ, cross-references, vault-memory update
README.md:
  - Added §1.5 'Architecture: Framework vs Project' with directory tree
    and lifecycle flow diagram
  - Added §2.5 FAQ covering coexistence, hooks, loops, multi-project
  - Updated install section already done in prior commit

AGENTS.md:
  - Added 'Script Cross-References' table mapping install.sh →
    onboard-project.sh → status.py --create-task

scripts/install-hooks.sh:
  - Updated header to reference onboard-project.sh as caller
  - Added 'Next step' line pointing to --create-task

vault-memory CONTEXT.md:
  - Updated test count (518→611)
  - Added new scripts (detect_models.py, onboard-project.sh)
  - Documented install/onboard flow and split architecture
2026-06-26 16:51:39 -04:00

55 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# install-hooks.sh — Install automaton git hooks into the current project.
#
# Usage: bash ~/.automaton/scripts/install-hooks.sh [project-path]
#
# Called automatically by onboard-project.sh. Can also be run manually
# after framework updates to refresh hooks.
#
# Installs pre-commit and pre-push hooks. The pre-commit hook blocks
# commits when no task is in implement/doc_review. The pre-push hook
# blocks pushes in the same condition, catching --no-verify bypasses.
#
# Next step: python3 ~/.automaton/scripts/status.py --create-task --project .
set -euo pipefail
PROJECT_DIR="${1:-$(pwd)}"
GIT_DIR="$PROJECT_DIR/.git"
HOOKS_DIR="$GIT_DIR/hooks"
FRAMEWORK_DIR="$HOME/.automaton"
if [ ! -d "$GIT_DIR" ]; then
echo "ERROR: $PROJECT_DIR is not a git repository (no .git directory)"
exit 1
fi
mkdir -p "$HOOKS_DIR"
HOOKS=(
"pre-commit"
"pre-push"
)
installed=0
for hook in "${HOOKS[@]}"; do
SOURCE="$FRAMEWORK_DIR/scripts/git-hooks/$hook"
TARGET="$HOOKS_DIR/$hook"
if [ ! -f "$SOURCE" ]; then
echo "WARNING: Source hook not found: $SOURCE"
continue
fi
cp "$SOURCE" "$TARGET"
chmod +x "$TARGET"
echo "Installed: $TARGET"
installed=$((installed + 1))
done
echo ""
echo "$installed hook(s) installed in $PROJECT_DIR"
echo ""
echo "Pre-commit: Blocks commits without an active task in implement/doc_review"
echo "Pre-push: Blocks pushes without an active task (catches --no-verify bypasses)"
echo ""
echo "To reinstall after automaton update, re-run this script."