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.
This commit is contained in:
Tommaso Casaburi
2026-03-10 15:49:15 +08:00
committed by GitHub
parent 878d0ee70b
commit a92b185a66
197 changed files with 20785 additions and 3 deletions
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
# afterFileEdit hook: Auto-format files after AI edits them
# 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 format JS/TS files
case "$file_path" in
*.js|*.ts|*.tsx|*.mjs)
# Match the other hooks by resolving relative paths from the repo root.
cd "$(dirname "$0")/../.." || exit 0
# Run oxfmt on the file (silent on success)
npx oxfmt "$file_path" 2>/dev/null || true
;;
esac
exit 0