mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
chore(ai-workflow): tighten agent workflow and worktree tooling (#1107)
* chore(ai-workflow): tighten agent workflow and worktree tooling * fix(ai-workflow): address review feedback * fix(ai-workflow): make format hook portable
This commit is contained in:
+2
-25
@@ -1,27 +1,4 @@
|
||||
#!/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
|
||||
repo_root="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
exec "$repo_root/scripts/agent-hooks/format.sh" "$@"
|
||||
|
||||
Reference in New Issue
Block a user