Files
5chan/.codex/hooks/yarn-install.sh
T
Tommaso CasaburiandGitHub a92b185a66 chore(ai-workflow): track repo-managed review tooling (#1046)
* chore(ai-workflow): track repo-managed review tooling

* fix(ai-workflow): remove repo-specific path assumptions

Make shared workflow hooks and APK testing guidance resolve paths from the repo and contributor environment so the tooling works for all contributors, not just one machine.
2026-03-10 15:49:15 +08:00

26 lines
711 B
Bash
Executable File

#!/bin/bash
# afterFileEdit hook: Run yarn install when package.json is changed
# Receives JSON via stdin: {"file_path": "...", "edits": [...]}
# Read stdin (required for hooks)
input=$(cat)
# Extract file_path using grep/sed (jq-free for portability)
file_path=$(echo "$input" | grep -o '"file_path"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*:.*"\([^"]*\)"/\1/')
# Exit if no file path found
if [ -z "$file_path" ]; then
exit 0
fi
# Only run yarn install if package.json was changed
if [ "$file_path" = "package.json" ]; then
# Change to project directory
cd "$(dirname "$0")/../.." || exit 0
echo "package.json changed - running yarn install to update yarn.lock..."
yarn install
fi
exit 0